Documentation ¶
Index ¶
- Constants
- Variables
- func AddTxnResponse(resp *clientv3.TxnResponse, jsonData string)
- func AssertProcessLogs(t *testing.T, ep EtcdProcess, expectLog string)
- func BeforeTest(t testing.TB)
- func CURLGet(clus *EtcdProcessCluster, req CURLReq) error
- func CURLPost(clus *EtcdProcessCluster, req CURLReq) error
- func CURLPrefixArgs(cfg *EtcdProcessClusterConfig, member EtcdProcess, 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 InitFlags()
- func RandomLeaseID() int64
- 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, name string) (*expect.ExpectProcess, error)
- func SpawnNamedCmd(processName string, args []string, envVars map[string]string) (*expect.ExpectProcess, error)
- func SpawnWithExpect(args []string, expected string) error
- func SpawnWithExpectLines(ctx context.Context, 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(ctx context.Context, exproc *expect.ExpectProcess, readyStrs []string) error
- type CURLReq
- type ClientConnType
- type EtcdProcess
- type EtcdProcessCluster
- func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
- func NewEtcdProcessCluster(ctx context.Context, t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
- func StartEtcdProcessCluster(ctx context.Context, 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) EndpointsV2() []string
- func (epc *EtcdProcessCluster) EndpointsV3() []string
- func (epc *EtcdProcessCluster) Restart(ctx context.Context) error
- func (epc *EtcdProcessCluster) RollingStart(ctx context.Context) error
- func (epc *EtcdProcessCluster) Start(ctx context.Context) error
- func (epc *EtcdProcessCluster) Stop() (err error)
- type EtcdProcessClusterConfig
- func ConfigStandalone(cfg EtcdProcessClusterConfig) *EtcdProcessClusterConfig
- func NewConfigAutoTLS() *EtcdProcessClusterConfig
- func NewConfigClientAutoTLS() *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) EndpointsMetrics() []string
- func (ep *EtcdServerProcess) EndpointsV2() []string
- func (ep *EtcdServerProcess) EndpointsV3() []string
- func (ep *EtcdServerProcess) Logs() LogsExpect
- func (ep *EtcdServerProcess) Restart(ctx context.Context) error
- func (ep *EtcdServerProcess) Start(ctx context.Context) error
- func (ep *EtcdServerProcess) Stop() (err error)
- type EtcdServerProcessConfig
- type EtcdctlV3
- func (ctl *EtcdctlV3) AlarmDisarm(ctx context.Context, _ *clientv3.AlarmMember) (*clientv3.AlarmResponse, error)
- func (ctl *EtcdctlV3) AlarmList(ctx context.Context) (*clientv3.AlarmResponse, error)
- func (ctl *EtcdctlV3) AuthDisable(ctx context.Context) (*clientv3.AuthDisableResponse, error)
- func (ctl *EtcdctlV3) AuthEnable(ctx context.Context) (*clientv3.AuthEnableResponse, error)
- func (ctl *EtcdctlV3) AuthStatus(ctx context.Context) (*clientv3.AuthStatusResponse, error)
- func (ctl *EtcdctlV3) Compact(ctx context.Context, rev int64, o config.CompactOption) (*clientv3.CompactResponse, error)
- func (ctl *EtcdctlV3) Defragment(ctx context.Context, o config.DefragOption) error
- func (ctl *EtcdctlV3) Delete(ctx context.Context, key string, o config.DeleteOptions) (*clientv3.DeleteResponse, error)
- func (ctl *EtcdctlV3) DowngradeEnable(ctx context.Context, version string) error
- func (ctl *EtcdctlV3) Get(ctx context.Context, key string, o config.GetOptions) (*clientv3.GetResponse, error)
- func (ctl *EtcdctlV3) Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error)
- func (ctl *EtcdctlV3) HashKV(ctx context.Context, rev int64) ([]*clientv3.HashKVResponse, error)
- func (ctl *EtcdctlV3) Health(ctx context.Context) error
- func (ctl *EtcdctlV3) KeepAliveOnce(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)
- func (ctl *EtcdctlV3) Leases(ctx context.Context) (*clientv3.LeaseLeasesResponse, error)
- func (ctl *EtcdctlV3) MemberAdd(ctx context.Context, name string, peerAddrs []string) (*clientv3.MemberAddResponse, error)
- func (ctl *EtcdctlV3) MemberAddAsLearner(ctx context.Context, name string, peerAddrs []string) (*clientv3.MemberAddResponse, error)
- func (ctl *EtcdctlV3) MemberList(ctx context.Context) (*clientv3.MemberListResponse, error)
- func (ctl *EtcdctlV3) MemberRemove(ctx context.Context, id uint64) (*clientv3.MemberRemoveResponse, error)
- func (ctl *EtcdctlV3) Put(ctx context.Context, key, value string, opts config.PutOptions) error
- func (ctl *EtcdctlV3) Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
- func (ctl *EtcdctlV3) RoleAdd(ctx context.Context, name string) (*clientv3.AuthRoleAddResponse, error)
- func (ctl *EtcdctlV3) RoleDelete(ctx context.Context, role string) (*clientv3.AuthRoleDeleteResponse, error)
- func (ctl *EtcdctlV3) RoleGet(ctx context.Context, role string) (*clientv3.AuthRoleGetResponse, error)
- func (ctl *EtcdctlV3) RoleGrantPermission(ctx context.Context, name string, key, rangeEnd string, ...) (*clientv3.AuthRoleGrantPermissionResponse, error)
- func (ctl *EtcdctlV3) RoleList(ctx context.Context) (*clientv3.AuthRoleListResponse, error)
- func (ctl *EtcdctlV3) RoleRevokePermission(ctx context.Context, role string, key, rangeEnd string) (*clientv3.AuthRoleRevokePermissionResponse, error)
- func (ctl *EtcdctlV3) Status(ctx context.Context) ([]*clientv3.StatusResponse, error)
- func (ctl *EtcdctlV3) TimeToLive(ctx context.Context, id clientv3.LeaseID, o config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)
- func (ctl *EtcdctlV3) Txn(ctx context.Context, compares, ifSucess, ifFail []string, o config.TxnOptions) (*clientv3.TxnResponse, error)
- func (ctl *EtcdctlV3) UserAdd(ctx context.Context, name, password string, opts config.UserAddOptions) (*clientv3.AuthUserAddResponse, error)
- func (ctl *EtcdctlV3) UserChangePass(ctx context.Context, user, newPass string) error
- func (ctl *EtcdctlV3) UserDelete(ctx context.Context, name string) (*clientv3.AuthUserDeleteResponse, error)
- func (ctl *EtcdctlV3) UserGet(ctx context.Context, name string) (*clientv3.AuthUserGetResponse, error)
- func (ctl *EtcdctlV3) UserGrantRole(ctx context.Context, user string, role string) (*clientv3.AuthUserGrantRoleResponse, error)
- func (ctl *EtcdctlV3) UserList(ctx context.Context) (*clientv3.AuthUserListResponse, error)
- func (ctl *EtcdctlV3) UserRevokeRole(ctx context.Context, user string, role string) (*clientv3.AuthUserRevokeRoleResponse, error)
- func (ctl *EtcdctlV3) Watch(ctx context.Context, key string, opts config.WatchOptions) clientv3.WatchChan
- func (ctl *EtcdctlV3) WithAuth(userName, password string) *EtcdctlV3
- type LogsExpect
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 AddTxnResponse ¶
func AddTxnResponse(resp *clientv3.TxnResponse, jsonData string)
AddTxnResponse looks for ResponseOp json tags and adds the objects for json decoding
func AssertProcessLogs ¶
func AssertProcessLogs(t *testing.T, ep EtcdProcess, expectLog string)
func BeforeTest ¶
func CURLGet ¶
func CURLGet(clus *EtcdProcessCluster, req CURLReq) error
func CURLPost ¶
func CURLPost(clus *EtcdProcessCluster, req CURLReq) error
func CURLPrefixArgs ¶
func CURLPrefixArgs(cfg *EtcdProcessClusterConfig, member EtcdProcess, 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 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 SkipInShortMode ¶
func SpawnCmdWithLogger ¶
func SpawnNamedCmd ¶
func SpawnWithExpect ¶
func SpawnWithExpectLines ¶
func SpawnWithExpectWithEnv ¶
func SpawnWithExpects ¶
func WaitReadyExpectProc ¶
Types ¶
type ClientConnType ¶
type ClientConnType int
const ( ClientNonTLS ClientConnType = iota ClientTLS ClientTLSAndNonTLS )
type EtcdProcess ¶
type EtcdProcess interface { EndpointsV2() []string EndpointsV3() []string EndpointsMetrics() []string Start(ctx context.Context) error Restart(ctx context.Context) error Stop() error Close() error Config() *EtcdServerProcessConfig Logs() LogsExpect }
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(ctx context.Context, t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdProcessCluster, error)
NewEtcdProcessCluster launches a new cluster from etcd processes, returning a new EtcdProcessCluster once all nodes are ready to accept client requests.
func StartEtcdProcessCluster ¶
func StartEtcdProcessCluster(ctx context.Context, 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(ctx context.Context) error
func (*EtcdProcessCluster) RollingStart ¶
func (epc *EtcdProcessCluster) RollingStart(ctx context.Context) error
func (*EtcdProcessCluster) Stop ¶
func (epc *EtcdProcessCluster) Stop() (err error)
type EtcdProcessClusterConfig ¶
type EtcdProcessClusterConfig struct { ExecPath string DataDirPath string KeepDataDir bool EnvVars map[string]string ClusterSize int BaseScheme string BasePort int MetricsURLScheme string SnapshotCount int // default is 10000 ClientTLS ClientConnType ClientCertAuthEnabled bool IsPeerTLS bool IsPeerAutoTLS bool IsClientAutoTLS bool IsClientCRL bool NoCN bool CipherSuites []string ForceNewCluster bool InitialToken string QuotaBackendBytes int64 DisableStrictReconfigCheck bool EnableV2 bool InitialCorruptCheck bool AuthTokenOpts string V2deprecation string RollingStart bool Discovery string // v2 discovery DiscoveryEndpoints []string // v3 discovery DiscoveryToken string LogLevel string MaxConcurrentStreams uint32 // default is math.MaxUint32 CorruptCheckTime time.Duration CompactHashCheckEnabled bool CompactHashCheckTime time.Duration }
func ConfigStandalone ¶
func ConfigStandalone(cfg EtcdProcessClusterConfig) *EtcdProcessClusterConfig
func NewConfigAutoTLS ¶
func NewConfigAutoTLS() *EtcdProcessClusterConfig
func NewConfigClientAutoTLS ¶
func NewConfigClientAutoTLS() *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) EndpointsMetrics ¶
func (ep *EtcdServerProcess) EndpointsMetrics() []string
func (*EtcdServerProcess) EndpointsV2 ¶
func (ep *EtcdServerProcess) EndpointsV2() []string
func (*EtcdServerProcess) EndpointsV3 ¶
func (ep *EtcdServerProcess) EndpointsV3() []string
func (*EtcdServerProcess) Logs ¶
func (ep *EtcdServerProcess) Logs() LogsExpect
func (*EtcdServerProcess) Stop ¶
func (ep *EtcdServerProcess) Stop() (err error)
type EtcdServerProcessConfig ¶
type EtcdctlV3 ¶
type EtcdctlV3 struct {
// contains filtered or unexported fields
}
func NewEtcdctl ¶
func NewEtcdctl(cfg *EtcdProcessClusterConfig, endpoints []string) *EtcdctlV3
func (*EtcdctlV3) AlarmDisarm ¶
func (ctl *EtcdctlV3) AlarmDisarm(ctx context.Context, _ *clientv3.AlarmMember) (*clientv3.AlarmResponse, error)
func (*EtcdctlV3) AuthDisable ¶
func (*EtcdctlV3) AuthEnable ¶
func (*EtcdctlV3) AuthStatus ¶
func (*EtcdctlV3) Compact ¶
func (ctl *EtcdctlV3) Compact(ctx context.Context, rev int64, o config.CompactOption) (*clientv3.CompactResponse, error)
func (*EtcdctlV3) Defragment ¶
func (*EtcdctlV3) Delete ¶
func (ctl *EtcdctlV3) Delete(ctx context.Context, key string, o config.DeleteOptions) (*clientv3.DeleteResponse, error)
func (*EtcdctlV3) DowngradeEnable ¶
func (*EtcdctlV3) Get ¶
func (ctl *EtcdctlV3) Get(ctx context.Context, key string, o config.GetOptions) (*clientv3.GetResponse, error)
func (*EtcdctlV3) KeepAliveOnce ¶
func (*EtcdctlV3) MemberAddAsLearner ¶
func (*EtcdctlV3) MemberList ¶
func (*EtcdctlV3) MemberRemove ¶
func (*EtcdctlV3) RoleDelete ¶
func (*EtcdctlV3) RoleGrantPermission ¶
func (ctl *EtcdctlV3) RoleGrantPermission(ctx context.Context, name string, key, rangeEnd string, permType clientv3.PermissionType) (*clientv3.AuthRoleGrantPermissionResponse, error)
func (*EtcdctlV3) RoleRevokePermission ¶
func (*EtcdctlV3) TimeToLive ¶
func (ctl *EtcdctlV3) TimeToLive(ctx context.Context, id clientv3.LeaseID, o config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)
func (*EtcdctlV3) Txn ¶
func (ctl *EtcdctlV3) Txn(ctx context.Context, compares, ifSucess, ifFail []string, o config.TxnOptions) (*clientv3.TxnResponse, error)
func (*EtcdctlV3) UserAdd ¶
func (ctl *EtcdctlV3) UserAdd(ctx context.Context, name, password string, opts config.UserAddOptions) (*clientv3.AuthUserAddResponse, error)
func (*EtcdctlV3) UserChangePass ¶
func (*EtcdctlV3) UserDelete ¶
func (*EtcdctlV3) UserGrantRole ¶
func (*EtcdctlV3) UserRevokeRole ¶
Click to show internal directories.
Click to hide internal directories.