Documentation ¶
Index ¶
- Constants
- func JSONEtcdKey(schemaID, uuid string) string
- func RetrieveCreateEvent(ctx context.Context, t *testing.T, watch clientv3.WatchChan) *clientv3.Event
- func RetrieveWatchEvents(ctx context.Context, t *testing.T, watch clientv3.WatchChan) []*clientv3.Event
- type EtcdClient
- func (e *EtcdClient) CheckKeyDoesNotExist(t *testing.T, key string)
- func (e *EtcdClient) Clear(t *testing.T) (revision int64)
- func (e *EtcdClient) Close(t *testing.T)
- func (e *EtcdClient) DeleteKey(t *testing.T, key string, opts ...clientv3.OpOption) (revision int64)
- func (e *EtcdClient) DeleteNetworkIPAM(t *testing.T, uuid string, opts ...clientv3.OpOption)
- func (e *EtcdClient) DeleteProject(t *testing.T, uuid string, opts ...clientv3.OpOption)
- func (e *EtcdClient) DeleteSecurityGroup(t *testing.T, uuid string, opts ...clientv3.OpOption)
- func (e *EtcdClient) ExpectValue(t *testing.T, key string, value string, revision int64)
- func (e *EtcdClient) GetKey(t *testing.T, key string, opts ...clientv3.OpOption) *clientv3.GetResponse
- func (e *EtcdClient) GetString(t *testing.T, key string) (value string, revision int64)
- func (e *EtcdClient) WaitForEvents(key string, awaitingEvents []map[string]interface{}, timeout time.Duration, ...) (collect func() ([]map[string]interface{}, error))
- func (e *EtcdClient) WatchKey(key string, opts ...clientv3.OpOption) (collect func() []string)
- func (e *EtcdClient) WatchKeyN(key string, n int, timeout time.Duration, opts ...clientv3.OpOption) (collect func() []string)
- func (e *EtcdClient) WatchResource(schemaID, uuid string, opts ...clientv3.OpOption) (clientv3.WatchChan, context.Context, context.CancelFunc)
Constants ¶
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 ¶
JSONEtcdKey returns etcd key of JSON-encoded resource.
Types ¶
type EtcdClient ¶
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 ¶
DeleteNetworkIPAM deletes NetworkIPAM resource.
func (*EtcdClient) DeleteProject ¶
DeleteProject deletes Project resource.
func (*EtcdClient) DeleteSecurityGroup ¶
DeleteSecurityGroup deletes SecurityGroup resource.
func (*EtcdClient) ExpectValue ¶
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) 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.