integrationetcd

package
v0.0.0-...-4a20579 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Endpoint           = "localhost:2379"
	Prefix             = "contrail"
	ETCDDialTimeout    = 10 * time.Second
	ETCDRequestTimeout = 10 * time.Second

	// Timeout for watchers on etcd. After it's duration the channel sends
	// an empty message and closes without error.
	// On CI dump can take longer than 10 seconds, so 60 seconds should be big enough.
	ETCDWatchTimeout = 60 * time.Second

	AccessControlListSchemaID    = "access_control_list"
	ApplicationPolicySetSchemaID = "application_policy_set"
	NetworkIPAMSchemaID          = "network_ipam"
	ProjectSchemaID              = "project"
	SecurityGroupSchemaID        = "security_group"
	VirtualNetworkSchemaID       = "virtual_network"
)

Integration test settings.

Variables

This section is empty.

Functions

func JSONEtcdKey

func JSONEtcdKey(schemaID, uuid string) string

JSONEtcdKey returns etcd key of JSON-encoded resource.

func RetrieveCreateEvent

func RetrieveCreateEvent(ctx context.Context, t *testing.T, watch clientv3.WatchChan) *clientv3.Event

RetrieveCreateEvent blocks and retrieves create Event from given watch channel.

func RetrieveWatchEvents

func RetrieveWatchEvents(ctx context.Context, t *testing.T, watch clientv3.WatchChan) []*clientv3.Event

RetrieveWatchEvents blocks and retrieves events from given watch channel.

Types

type EtcdClient

type EtcdClient struct {
	*clientv3.Client
	// contains filtered or unexported fields
}

EtcdClient is etcd client extending etcd.clientv3 with test functionality and using etcd v3 API.

func NewEtcdClient

func NewEtcdClient(t *testing.T) *EtcdClient

NewEtcdClient is a constructor of etcd client. After usage Close() needs to be called to close underlying connections.

func (*EtcdClient) CheckKeyDoesNotExist

func (e *EtcdClient) CheckKeyDoesNotExist(t *testing.T, key string)

CheckKeyDoesNotExist checks that there is no value on given key.

func (*EtcdClient) Clear

func (e *EtcdClient) Clear(t *testing.T) (revision int64)

Clear recursively deletes all keys starting with "etcd.path" prefix.

func (*EtcdClient) Close

func (e *EtcdClient) Close(t *testing.T)

Close closes connection to etcd.

func (*EtcdClient) DeleteKey

func (e *EtcdClient) DeleteKey(t *testing.T, key string, opts ...clientv3.OpOption) (revision int64)

DeleteKey deletes etcd key.

func (*EtcdClient) DeleteNetworkIPAM

func (e *EtcdClient) DeleteNetworkIPAM(t *testing.T, uuid string, opts ...clientv3.OpOption)

DeleteNetworkIPAM deletes NetworkIPAM resource.

func (*EtcdClient) DeleteProject

func (e *EtcdClient) DeleteProject(t *testing.T, uuid string, opts ...clientv3.OpOption)

DeleteProject deletes Project resource.

func (*EtcdClient) DeleteSecurityGroup

func (e *EtcdClient) DeleteSecurityGroup(t *testing.T, uuid string, opts ...clientv3.OpOption)

DeleteSecurityGroup deletes SecurityGroup resource.

func (*EtcdClient) ExpectValue

func (e *EtcdClient) ExpectValue(t *testing.T, key string, value string, revision int64)

ExpectValue gets key and checks if value and revision match.

func (*EtcdClient) GetKey

func (e *EtcdClient) GetKey(t *testing.T, key string, opts ...clientv3.OpOption) *clientv3.GetResponse

GetKey gets etcd key.

func (*EtcdClient) GetString

func (e *EtcdClient) GetString(t *testing.T, key string) (value string, revision int64)

GetString gets a string value in etcd.

func (*EtcdClient) WaitForEvents

func (e *EtcdClient) WaitForEvents(
	key string, awaitingEvents []map[string]interface{}, timeout time.Duration, opts ...clientv3.OpOption,
) (collect func() ([]map[string]interface{}, error))

WaitForEvents waits for events to show up before moving to the next task.

func (*EtcdClient) WatchKey

func (e *EtcdClient) WatchKey(
	key string, opts ...clientv3.OpOption,
) (collect func() []string)

WatchKey watches value changes for provided key and returns collect method that collect captured values.

func (*EtcdClient) WatchKeyN

func (e *EtcdClient) WatchKeyN(
	key string, n int, timeout time.Duration, opts ...clientv3.OpOption,
) (collect func() []string)

WatchKeyN watches value changes for provided key n times and returns collect method that collects the captured values. If there were less than n events then it waits until timeout passes.

func (*EtcdClient) WatchResource

func (e *EtcdClient) WatchResource(
	schemaID, uuid string, opts ...clientv3.OpOption,
) (clientv3.WatchChan, context.Context, context.CancelFunc)

WatchResource spawns a watch on specified resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL