Documentation ¶
Index ¶
- Constants
- Variables
- func AddV2Args(args []string) []string
- func BeforeTest(t testing.TB)
- func CURLGet(clus *EtcdProcessCluster, req CURLReq) error
- func CURLPost(clus *EtcdProcessCluster, req CURLReq) error
- func CURLPrefixArgs(clientURL string, connType ClientConnType, CN bool, method string, req CURLReq) []string
- func CURLPrefixArgsCluster(clus *EtcdProcessCluster, method string, req CURLReq) []string
- func CURLPut(clus *EtcdProcessCluster, req CURLReq) error
- func CloseWithTimeout(p *expect.ExpectProcess, d time.Duration) error
- func DataMarshal(data interface{}) (d string, e error)
- func ExecuteUntil(ctx context.Context, t *testing.T, f func())
- func InitFlags()
- func RandomLeaseID() int64
- func RunUtilCompletion(args []string, envVars map[string]string) ([]string, error)
- func SkipInShortMode(t testing.TB)
- func SpawnCmd(args []string, envVars map[string]string) (*expect.ExpectProcess, error)
- func SpawnCmdWithLogger(lg *zap.Logger, args []string, envVars map[string]string) (*expect.ExpectProcess, error)
- func SpawnWithExpect(args []string, expected string) error
- func SpawnWithExpectLines(args []string, envVars map[string]string, xs ...string) ([]string, error)
- func SpawnWithExpectWithEnv(args []string, envVars map[string]string, expected string) error
- func SpawnWithExpects(args []string, envVars map[string]string, xs ...string) error
- func ToTLS(s string) string
- func WaitReadyExpectProc(exproc *expect.ExpectProcess, readyStrs []string) error
- type BinaryFailpoints
- func (f *BinaryFailpoints) Available(failpoint string) bool
- func (f *BinaryFailpoints) DeactivateHTTP(ctx context.Context, failpoint string) error
- func (f *BinaryFailpoints) Enabled() bool
- func (f *BinaryFailpoints) SetupEnv(failpoint, payload string) error
- func (f *BinaryFailpoints) SetupHTTP(ctx context.Context, failpoint, payload string) error
- type CURLReq
- type ClientConnType
- type EtcdProcess
- type EtcdProcessCluster
- func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
- func NewEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
- func StartEtcdProcessCluster(t testing.TB, epc *EtcdProcessCluster, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
- func (epc *EtcdProcessCluster) Close() error
- func (epc *EtcdProcessCluster) Endpoints(f func(ep EtcdProcess) []string) (ret []string)
- func (epc *EtcdProcessCluster) EndpointsGRPC() []string
- func (epc *EtcdProcessCluster) EndpointsHTTP() []string
- func (epc *EtcdProcessCluster) EndpointsV2() []string
- func (epc *EtcdProcessCluster) EndpointsV3() []string
- func (epc *EtcdProcessCluster) Restart() error
- func (epc *EtcdProcessCluster) RollingStart() error
- func (epc *EtcdProcessCluster) Start() error
- func (epc *EtcdProcessCluster) Stop() (err error)
- func (epc *EtcdProcessCluster) WaitLeader(t testing.TB) int
- func (epc *EtcdProcessCluster) WaitMembersForLeader(ctx context.Context, t testing.TB, membs []EtcdProcess) int
- func (epc *EtcdProcessCluster) WithStopSignal(sig os.Signal) (ret os.Signal)
- type EtcdProcessClusterConfig
- func ConfigStandalone(cfg EtcdProcessClusterConfig) *EtcdProcessClusterConfig
- func NewConfigAutoTLS() *EtcdProcessClusterConfig
- func NewConfigClientAutoTLS() *EtcdProcessClusterConfig
- func NewConfigClientBoth() *EtcdProcessClusterConfig
- func NewConfigClientTLS() *EtcdProcessClusterConfig
- func NewConfigClientTLSCertAuth() *EtcdProcessClusterConfig
- func NewConfigClientTLSCertAuthWithNoCN() *EtcdProcessClusterConfig
- func NewConfigJWT() *EtcdProcessClusterConfig
- func NewConfigNoTLS() *EtcdProcessClusterConfig
- func NewConfigPeerTLS() *EtcdProcessClusterConfig
- func NewConfigTLS() *EtcdProcessClusterConfig
- type EtcdServerProcess
- func (ep *EtcdServerProcess) Close() error
- func (ep *EtcdServerProcess) Config() *EtcdServerProcessConfig
- func (ep *EtcdServerProcess) EndpointsGRPC() []string
- func (ep *EtcdServerProcess) EndpointsHTTP() []string
- func (ep *EtcdServerProcess) EndpointsMetrics() []string
- func (ep *EtcdServerProcess) EndpointsV2() []string
- func (ep *EtcdServerProcess) EndpointsV3() []string
- func (ep *EtcdServerProcess) Etcdctl(connType ClientConnType, isAutoTLS, v2 bool) *Etcdctl
- func (ep *EtcdServerProcess) Failpoints() *BinaryFailpoints
- func (ep *EtcdServerProcess) IsRunning() bool
- func (ep *EtcdServerProcess) Logs() LogsExpect
- func (ep *EtcdServerProcess) PeerProxy() proxy.Server
- func (ep *EtcdServerProcess) Restart() error
- func (ep *EtcdServerProcess) Start() error
- func (ep *EtcdServerProcess) Stop() (err error)
- func (ep *EtcdServerProcess) WithStopSignal(sig os.Signal) os.Signal
- type EtcdServerProcessConfig
- type Etcdctl
- func (ctl *Etcdctl) AlarmList() (*clientv3.AlarmResponse, error)
- func (ctl *Etcdctl) AuthEnable() error
- func (ctl *Etcdctl) Compact(rev int64) (*clientv3.CompactResponse, error)
- func (ctl *Etcdctl) Get(key string) (*clientv3.GetResponse, error)
- func (ctl *Etcdctl) MemberAdd(name string, peerURLs []string) (*clientv3.MemberAddResponse, error)
- func (ctl *Etcdctl) MemberList() (*clientv3.MemberListResponse, error)
- func (ctl *Etcdctl) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)
- func (ctl *Etcdctl) Put(key, value string) error
- func (ctl *Etcdctl) PutWithAuth(key, value, username, password string) error
- func (ctl *Etcdctl) Set(key, value string) error
- func (ctl *Etcdctl) Status() ([]*clientv3.StatusResponse, error)
- func (ctl *Etcdctl) UserAdd(name, password string) (*clientv3.AuthUserAddResponse, error)
- func (ctl *Etcdctl) UserGrantRole(user string, role string) (*clientv3.AuthUserGrantRoleResponse, error)
- type LogsExpect
Constants ¶
const EtcdProcessBasePort = 20000
Variables ¶
var ( EtcdServerReadyLines = []string{"ready to serve client requests"} BinPath string CtlBinPath string UtlBinPath string )
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 BeforeTest ¶
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 RandomLeaseID ¶
func RandomLeaseID() int64
func RunUtilCompletion ¶
func SkipInShortMode ¶
func SpawnCmdWithLogger ¶
func SpawnWithExpect ¶
func SpawnWithExpectLines ¶
func SpawnWithExpectWithEnv ¶
func SpawnWithExpects ¶
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
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 ConfigStandalone ¶
func ConfigStandalone(cfg EtcdProcessClusterConfig) *EtcdProcessClusterConfig
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 (ep *EtcdServerProcess) Config() *EtcdServerProcessConfig
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) AuthEnable ¶
func (*Etcdctl) MemberList ¶
func (ctl *Etcdctl) MemberList() (*clientv3.MemberListResponse, error)
func (*Etcdctl) MemberRemove ¶
func (ctl *Etcdctl) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)
func (*Etcdctl) PutWithAuth ¶
func (*Etcdctl) UserAdd ¶
func (ctl *Etcdctl) UserAdd(name, password string) (*clientv3.AuthUserAddResponse, error)