integration

package
v3.3.11+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 40 Imported by: 21

Documentation

Overview

Package integration implements tests built upon embedded etcd, and focus on etcd correctness.

Features/goals of the integration tests: 1. test the whole code base except command-line parsing. 2. check internal data, including raft, store and etc. 3. based on goroutines, which is faster than process. 4. mainly tests user behavior and user-facing API.

Index

Constants

View Source
const (
	// RequestWaitTimeout is the time duration to wait for a request to go through or detect leader loss.
	RequestWaitTimeout = 3 * time.Second

	UrlScheme    = "unix"
	UrlSchemeTLS = "unixs"
)

Variables

This section is empty.

Functions

func MustNewHTTPClient

func MustNewHTTPClient(t *testing.T, eps []string, tls *transport.TLSInfo) client.Client

func NewClientV3

func NewClientV3(m *member) (*clientv3.Client, error)

NewClientV3 creates a new grpc client connection to the member

func NewCluster

func NewCluster(t *testing.T, size int) *cluster

NewCluster returns an unlaunched cluster of the given size which has been set to use static bootstrap.

func NewClusterByConfig

func NewClusterByConfig(t *testing.T, cfg *ClusterConfig) *cluster

NewClusterByConfig returns an unlaunched cluster defined by a cluster configuration

func NewListenerWithAddr

func NewListenerWithAddr(t *testing.T, addr string) net.Listener

Types

type ClusterConfig

type ClusterConfig struct {
	Size                  int
	PeerTLS               *transport.TLSInfo
	ClientTLS             *transport.TLSInfo
	DiscoveryURL          string
	UseGRPC               bool
	QuotaBackendBytes     int64
	MaxTxnOps             uint
	MaxRequestBytes       uint
	GRPCKeepAliveMinTime  time.Duration
	GRPCKeepAliveInterval time.Duration
	GRPCKeepAliveTimeout  time.Duration
	// SkipCreatingClient to skip creating clients for each member.
	SkipCreatingClient bool

	ClientMaxCallSendMsgSize int
	ClientMaxCallRecvMsgSize int
}

type ClusterV3

type ClusterV3 struct {
	// contains filtered or unexported fields
}

func NewClusterV3

func NewClusterV3(t *testing.T, cfg *ClusterConfig) *ClusterV3

NewClusterV3 returns a launched cluster with a grpc client connection for each cluster member.

func (ClusterV3) AddMember

func (c ClusterV3) AddMember(t *testing.T)

func (*ClusterV3) Client

func (c *ClusterV3) Client(i int) *clientv3.Client

func (ClusterV3) HTTPMembers

func (c ClusterV3) HTTPMembers() []client.Member

HTTPMembers returns a list of all active members as client.Members

func (ClusterV3) Launch

func (c ClusterV3) Launch(t *testing.T)

func (*ClusterV3) RandClient

func (c *ClusterV3) RandClient() *clientv3.Client

func (ClusterV3) RemoveMember

func (c ClusterV3) RemoveMember(t *testing.T, id uint64)

func (*ClusterV3) TakeClient

func (c *ClusterV3) TakeClient(idx int)

func (*ClusterV3) Terminate

func (c *ClusterV3) Terminate(t *testing.T)

func (ClusterV3) URL

func (c ClusterV3) URL(i int) string

func (ClusterV3) URLs

func (c ClusterV3) URLs() []string

URLs returns a list of all active client URLs in the cluster

func (ClusterV3) WaitLeader

func (c ClusterV3) WaitLeader(t *testing.T) int

func (ClusterV3) WaitNoLeader

func (c ClusterV3) WaitNoLeader(t *testing.T)

type SortableMemberSliceByPeerURLs

type SortableMemberSliceByPeerURLs []client.Member

func (SortableMemberSliceByPeerURLs) Len

func (SortableMemberSliceByPeerURLs) Less

func (p SortableMemberSliceByPeerURLs) Less(i, j int) bool

func (SortableMemberSliceByPeerURLs) Swap

func (p SortableMemberSliceByPeerURLs) Swap(i, j int)

Jump to

Keyboard shortcuts

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