tester

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package tester implements functional-tester tester server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case interface {
	// Inject injeccts the failure into the testing cluster at the given
	// round. When calling the function, the cluster should be in health.
	Inject(clus *Cluster) error
	// Recover recovers the injected failure caused by the injection of the
	// given round and wait for the recovery of the testing cluster.
	Recover(clus *Cluster) error
	// Desc returns a description of the failure
	Desc() string
	// TestCase returns "rpcpb.Case" enum type.
	TestCase() rpcpb.Case
}

Case defines failure/test injection interface. To add a test case:

  1. implement "Case" interface
  2. define fail case name in "rpcpb.Case"

type Checker

type Checker interface {
	// Type returns the checker type.
	Type() rpcpb.Checker
	// EtcdClientEndpoints returns the client endpoints of
	// all checker target nodes..
	EtcdClientEndpoints() []string
	// Check returns an error if the system fails a consistency check.
	Check() error
}

Checker checks cluster consistency.

type Cluster

type Cluster struct {
	Members []*rpcpb.Member `yaml:"agent-configs"`
	Tester  *rpcpb.Tester   `yaml:"tester-config"`
	// contains filtered or unexported fields
}

Cluster defines tester cluster.

func NewCluster

func NewCluster(lg *zap.Logger, fpath string) (*Cluster, error)

NewCluster creates a client from a tester configuration.

func (*Cluster) EtcdClientEndpoints

func (clus *Cluster) EtcdClientEndpoints() (css []string)

EtcdClientEndpoints returns all etcd client endpoints.

func (*Cluster) GetCaseDelayDuration

func (clus *Cluster) GetCaseDelayDuration() time.Duration

GetCaseDelayDuration computes failure delay duration.

func (*Cluster) GetLeader

func (clus *Cluster) GetLeader() (int, error)

GetLeader returns the index of leader and error if any.

func (*Cluster) Report

func (clus *Cluster) Report() int64

Report reports the number of modified keys.

func (*Cluster) Run

func (clus *Cluster) Run()

Run starts tester.

func (*Cluster) Send_INITIAL_START_ETCD

func (clus *Cluster) Send_INITIAL_START_ETCD() error

Send_INITIAL_START_ETCD bootstraps etcd cluster the very first time. After this, just continue to call kill/restart.

func (*Cluster) Send_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT

func (clus *Cluster) Send_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT()

Send_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT terminates all tester connections to agents and etcd servers.

func (*Cluster) UpdateDelayLatencyMs

func (clus *Cluster) UpdateDelayLatencyMs()

UpdateDelayLatencyMs updates delay latency with random value within election timeout.

func (*Cluster) WaitHealth

func (clus *Cluster) WaitHealth() error

WaitHealth ensures all members are healthy by writing a test key to etcd cluster.

type Stresser

type Stresser interface {
	// Stress starts to stress the etcd cluster
	Stress() error
	// Pause stops the stresser from sending requests to etcd. Resume by calling Stress.
	Pause() map[string]int
	// Close releases all of the Stresser's resources.
	Close() map[string]int
	// ModifiedKeys reports the number of keys created and deleted by stresser
	ModifiedKeys() int64
}

Stresser defines stressing client operations.

Jump to

Keyboard shortcuts

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