e2e

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 27 Imported by: ? 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 EtcdProcessBasePort = 20000

Variables

View Source
var (
	EtcdServerReadyLines = []string{"ready to serve client requests"}
	BinPath              string
	CtlBinPath           string
	UtlBinPath           string
)
View Source
var (
	BinDir  string
	CertDir string

	CertPath       string
	PrivateKeyPath string
	CaPath         string

	CertPath2       string
	PrivateKeyPath2 string

	CertPath3       string
	PrivateKeyPath3 string

	CrlPath               string
	RevokedCertPath       string
	RevokedPrivateKeyPath string

	FixturesDir = integration.MustAbsPath("../fixtures")
)

Functions

func AddV2Args

func AddV2Args(args []string) []string

func BeforeTest

func BeforeTest(t testing.TB)

func CURLGet

func CURLGet(clus *EtcdProcessCluster, req CURLReq) error

func CURLPost

func CURLPost(clus *EtcdProcessCluster, req CURLReq) error

func CURLPrefixArgs

func CURLPrefixArgs(clientURL string, connType ClientConnType, CN bool, method string, req CURLReq) []string

CURLPrefixArgs builds the beginning of a curl command for a given key addressed to a random URL in the given cluster.

func CURLPrefixArgsCluster

func CURLPrefixArgsCluster(clus *EtcdProcessCluster, method string, req CURLReq) []string

CURLPrefixArgsCluster builds the beginning of a curl command for a given key addressed to a random URL in the given cluster.

func CURLPut

func CURLPut(clus *EtcdProcessCluster, req CURLReq) error

func CloseWithTimeout

func CloseWithTimeout(p *expect.ExpectProcess, d time.Duration) error

func DataMarshal

func DataMarshal(data interface{}) (d string, e error)

func ExecuteUntil

func ExecuteUntil(ctx context.Context, t *testing.T, f func())

func InitFlags

func InitFlags()

func RandomLeaseID

func RandomLeaseID() int64

func RunUtilCompletion

func RunUtilCompletion(args []string, envVars map[string]string) ([]string, error)

func SkipInShortMode

func SkipInShortMode(t testing.TB)

func SpawnCmd

func SpawnCmd(args []string, envVars map[string]string) (*expect.ExpectProcess, error)

func SpawnCmdWithLogger

func SpawnCmdWithLogger(lg *zap.Logger, args []string, envVars map[string]string) (*expect.ExpectProcess, error)

func SpawnWithExpect

func SpawnWithExpect(args []string, expected string) error

func SpawnWithExpectLines

func SpawnWithExpectLines(args []string, envVars map[string]string, xs ...string) ([]string, error)

func SpawnWithExpectWithEnv

func SpawnWithExpectWithEnv(args []string, envVars map[string]string, expected string) error

func SpawnWithExpects

func SpawnWithExpects(args []string, envVars map[string]string, xs ...string) error

func ToTLS

func ToTLS(s string) string

func WaitReadyExpectProc

func WaitReadyExpectProc(exproc *expect.ExpectProcess, readyStrs []string) error

Types

type BinaryFailpoints

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

func (*BinaryFailpoints) Available

func (f *BinaryFailpoints) Available(failpoint string) bool

func (*BinaryFailpoints) DeactivateHTTP

func (f *BinaryFailpoints) DeactivateHTTP(ctx context.Context, failpoint string) error

func (*BinaryFailpoints) Enabled

func (f *BinaryFailpoints) Enabled() bool

func (*BinaryFailpoints) SetupEnv

func (f *BinaryFailpoints) SetupEnv(failpoint, payload string) error

func (*BinaryFailpoints) SetupHTTP

func (f *BinaryFailpoints) SetupHTTP(ctx context.Context, failpoint, payload string) error

type CURLReq

type CURLReq struct {
	Username string
	Password string

	IsTLS   bool
	Timeout int

	Endpoint string

	Value    string
	Expected string
	Header   string

	MetricsURLScheme string

	Ciphers     string
	HttpVersion string

	OutputFile string
}

type ClientConnType

type ClientConnType int
const (
	ClientNonTLS ClientConnType = iota
	ClientTLS
	ClientTLSAndNonTLS
)

type EtcdProcess

type EtcdProcess interface {
	EndpointsV2() []string
	EndpointsV3() []string
	EndpointsGRPC() []string
	EndpointsHTTP() []string
	EndpointsMetrics() []string

	Start() error
	Restart() error
	Stop() error
	Close() error
	WithStopSignal(sig os.Signal) os.Signal
	Config() *EtcdServerProcessConfig
	Logs() LogsExpect

	PeerProxy() proxy.Server
	Failpoints() *BinaryFailpoints
	IsRunning() bool

	Etcdctl(connType ClientConnType, isAutoTLS bool, v2 bool) *Etcdctl
}

EtcdProcess is a process that serves etcd requests.

func NewEtcdProcess

func NewEtcdProcess(cfg *EtcdServerProcessConfig) (EtcdProcess, error)

type EtcdProcessCluster

type EtcdProcessCluster struct {
	Cfg   *EtcdProcessClusterConfig
	Procs []EtcdProcess
	// contains filtered or unexported fields
}

func InitEtcdProcessCluster

func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)

InitEtcdProcessCluster initializes a new cluster based on the given config. It doesn't start the cluster.

func NewEtcdProcessCluster

func NewEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)

NewEtcdProcessCluster launches a new cluster from etcd processes, returning a new NewEtcdProcessCluster once all nodes are ready to accept client requests.

func StartEtcdProcessCluster

func StartEtcdProcessCluster(t testing.TB, epc *EtcdProcessCluster, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)

StartEtcdProcessCluster launches a new cluster from etcd processes.

func (*EtcdProcessCluster) Close

func (epc *EtcdProcessCluster) Close() error

func (*EtcdProcessCluster) Endpoints

func (epc *EtcdProcessCluster) Endpoints(f func(ep EtcdProcess) []string) (ret []string)

func (*EtcdProcessCluster) EndpointsGRPC

func (epc *EtcdProcessCluster) EndpointsGRPC() []string

func (*EtcdProcessCluster) EndpointsHTTP

func (epc *EtcdProcessCluster) EndpointsHTTP() []string

func (*EtcdProcessCluster) EndpointsV2

func (epc *EtcdProcessCluster) EndpointsV2() []string

func (*EtcdProcessCluster) EndpointsV3

func (epc *EtcdProcessCluster) EndpointsV3() []string

func (*EtcdProcessCluster) Restart

func (epc *EtcdProcessCluster) Restart() error

func (*EtcdProcessCluster) RollingStart

func (epc *EtcdProcessCluster) RollingStart() error

func (*EtcdProcessCluster) Start

func (epc *EtcdProcessCluster) Start() error

func (*EtcdProcessCluster) Stop

func (epc *EtcdProcessCluster) Stop() (err error)

func (*EtcdProcessCluster) WaitLeader

func (epc *EtcdProcessCluster) WaitLeader(t testing.TB) int

WaitLeader returns index of the member in c.Members() that is leader or fails the test (if not established in 30s).

func (*EtcdProcessCluster) WaitMembersForLeader

func (epc *EtcdProcessCluster) WaitMembersForLeader(ctx context.Context, t testing.TB, membs []EtcdProcess) int

WaitMembersForLeader waits until given members agree on the same leader, and returns its 'index' in the 'membs' list

func (*EtcdProcessCluster) WithStopSignal

func (epc *EtcdProcessCluster) WithStopSignal(sig os.Signal) (ret os.Signal)

type EtcdProcessClusterConfig

type EtcdProcessClusterConfig struct {
	ExecPath            string
	DataDirPath         string
	KeepDataDir         bool
	GoFailEnabled       bool
	GoFailClientTimeout time.Duration
	PeerProxy           bool
	EnvVars             map[string]string

	ClusterSize int

	// BasePeerScheme specifies scheme of --listen-peer-urls and --initial-advertise-peer-urls
	BasePeerScheme string
	BasePort       int
	// BaseClientScheme specifies scheme of --listen-client-urls, --listen-client-http-urls and --initial-advertise-client-urls
	BaseClientScheme string

	MetricsURLScheme string

	SnapshotCount int // default is 10000

	ClientTLS             ClientConnType
	ClientCertAuthEnabled bool
	ClientHttpSeparate    bool
	IsPeerTLS             bool
	IsPeerAutoTLS         bool
	IsClientAutoTLS       bool
	IsClientCRL           bool
	NoCN                  bool

	CipherSuites []string

	ForceNewCluster     bool
	InitialToken        string
	QuotaBackendBytes   int64
	NoStrictReconfig    bool
	EnableV2            bool
	InitialCorruptCheck bool
	AuthTokenOpts       string
	V2deprecation       string

	RollingStart bool
	LogLevel     string

	MaxConcurrentStreams       uint32 // default is math.MaxUint32
	CorruptCheckTime           time.Duration
	CompactHashCheckEnabled    bool
	CompactHashCheckTime       time.Duration
	WatchProcessNotifyInterval time.Duration
	CompactionBatchLimit       int
}

func NewConfigAutoTLS

func NewConfigAutoTLS() *EtcdProcessClusterConfig

func NewConfigClientAutoTLS

func NewConfigClientAutoTLS() *EtcdProcessClusterConfig

func NewConfigClientBoth

func NewConfigClientBoth() *EtcdProcessClusterConfig

func NewConfigClientTLS

func NewConfigClientTLS() *EtcdProcessClusterConfig

func NewConfigClientTLSCertAuth

func NewConfigClientTLSCertAuth() *EtcdProcessClusterConfig

func NewConfigClientTLSCertAuthWithNoCN

func NewConfigClientTLSCertAuthWithNoCN() *EtcdProcessClusterConfig

func NewConfigJWT

func NewConfigJWT() *EtcdProcessClusterConfig

func NewConfigNoTLS

func NewConfigNoTLS() *EtcdProcessClusterConfig

func NewConfigPeerTLS

func NewConfigPeerTLS() *EtcdProcessClusterConfig

func NewConfigTLS

func NewConfigTLS() *EtcdProcessClusterConfig

func (*EtcdProcessClusterConfig) ClientScheme

func (cfg *EtcdProcessClusterConfig) ClientScheme() string

func (*EtcdProcessClusterConfig) EtcdServerProcessConfigs

func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfigs(tb testing.TB) []*EtcdServerProcessConfig

func (*EtcdProcessClusterConfig) PeerScheme

func (cfg *EtcdProcessClusterConfig) PeerScheme() string

func (*EtcdProcessClusterConfig) TlsArgs

func (cfg *EtcdProcessClusterConfig) TlsArgs() (args []string)

type EtcdServerProcess

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

func NewEtcdServerProcess

func NewEtcdServerProcess(cfg *EtcdServerProcessConfig) (*EtcdServerProcess, error)

func (*EtcdServerProcess) Close

func (ep *EtcdServerProcess) Close() error

func (*EtcdServerProcess) Config

func (*EtcdServerProcess) EndpointsGRPC

func (ep *EtcdServerProcess) EndpointsGRPC() []string

func (*EtcdServerProcess) EndpointsHTTP

func (ep *EtcdServerProcess) EndpointsHTTP() []string

func (*EtcdServerProcess) EndpointsMetrics

func (ep *EtcdServerProcess) EndpointsMetrics() []string

func (*EtcdServerProcess) EndpointsV2

func (ep *EtcdServerProcess) EndpointsV2() []string

func (*EtcdServerProcess) EndpointsV3

func (ep *EtcdServerProcess) EndpointsV3() []string

func (*EtcdServerProcess) Etcdctl

func (ep *EtcdServerProcess) Etcdctl(connType ClientConnType, isAutoTLS, v2 bool) *Etcdctl

func (*EtcdServerProcess) Failpoints

func (ep *EtcdServerProcess) Failpoints() *BinaryFailpoints

func (*EtcdServerProcess) IsRunning

func (ep *EtcdServerProcess) IsRunning() bool

func (*EtcdServerProcess) Logs

func (ep *EtcdServerProcess) Logs() LogsExpect

func (*EtcdServerProcess) PeerProxy

func (ep *EtcdServerProcess) PeerProxy() proxy.Server

func (*EtcdServerProcess) Restart

func (ep *EtcdServerProcess) Restart() error

func (*EtcdServerProcess) Start

func (ep *EtcdServerProcess) Start() error

func (*EtcdServerProcess) Stop

func (ep *EtcdServerProcess) Stop() (err error)

func (*EtcdServerProcess) WithStopSignal

func (ep *EtcdServerProcess) WithStopSignal(sig os.Signal) os.Signal

type EtcdServerProcessConfig

type EtcdServerProcessConfig struct {
	ExecPath string
	Args     []string
	TlsArgs  []string
	EnvVars  map[string]string

	DataDirPath string
	KeepDataDir bool

	Name string

	Purl url.URL

	Acurl         string
	Murl          string
	ClientHttpUrl string

	InitialToken        string
	InitialCluster      string
	GoFailPort          int
	GoFailClientTimeout time.Duration
	Proxy               *proxy.ServerConfig
	// contains filtered or unexported fields
}

type Etcdctl

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

func NewEtcdctl

func NewEtcdctl(endpoints []string, connType ClientConnType, isAutoTLS bool, v2 bool) *Etcdctl

func (*Etcdctl) AlarmList

func (ctl *Etcdctl) AlarmList() (*clientv3.AlarmResponse, error)

func (*Etcdctl) AuthEnable

func (ctl *Etcdctl) AuthEnable() error

func (*Etcdctl) Compact

func (ctl *Etcdctl) Compact(rev int64) (*clientv3.CompactResponse, error)

func (*Etcdctl) Get

func (ctl *Etcdctl) Get(key string) (*clientv3.GetResponse, error)

func (*Etcdctl) MemberAdd

func (ctl *Etcdctl) MemberAdd(name string, peerURLs []string) (*clientv3.MemberAddResponse, error)

func (*Etcdctl) MemberList

func (ctl *Etcdctl) MemberList() (*clientv3.MemberListResponse, error)

func (*Etcdctl) MemberRemove

func (ctl *Etcdctl) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)

func (*Etcdctl) Put

func (ctl *Etcdctl) Put(key, value string) error

func (*Etcdctl) PutWithAuth

func (ctl *Etcdctl) PutWithAuth(key, value, username, password string) error

func (*Etcdctl) Set

func (ctl *Etcdctl) Set(key, value string) error

func (*Etcdctl) Status

func (ctl *Etcdctl) Status() ([]*clientv3.StatusResponse, error)

func (*Etcdctl) UserAdd

func (ctl *Etcdctl) UserAdd(name, password string) (*clientv3.AuthUserAddResponse, error)

func (*Etcdctl) UserGrantRole

func (ctl *Etcdctl) UserGrantRole(user string, role string) (*clientv3.AuthUserGrantRoleResponse, error)

type LogsExpect

type LogsExpect interface {
	Expect(string) (string, error)
	Lines() []string
	LineCount() int
}

Jump to

Keyboard shortcuts

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