e2e

package
v3.5.12 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 26 Imported by: 5

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
}

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) 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) WithStopSignal

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

type EtcdProcessClusterConfig

type EtcdProcessClusterConfig struct {
	ExecPath      string
	DataDirPath   string
	KeepDataDir   bool
	GoFailEnabled bool
	PeerProxy     bool
	EnvVars       map[string]string

	ClusterSize int

	BaseScheme string
	BasePort   int

	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) 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
	Proxy          *proxy.ServerConfig
	// contains filtered or unexported fields
}

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