e2e

package
v0.0.0-...-690b2a9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLeaderNotFound = errors.New("leader not found")

ErrLeaderNotFound is returned when the leader is not found.

Functions

func CreateJobViaHTTP

func CreateJobViaHTTP(ctx context.Context, masterAddr, tenantID, projectID string, jobType pb.Job_Type, config []byte) (string, error)

CreateJobViaHTTP creates a job via http.

func QueryJobViaHTTP

func QueryJobViaHTTP(ctx context.Context, masterAddr, tenantID, projectID, jobID string) (*pb.Job, error)

QueryJobViaHTTP queries a job via http.

Types

type ChaosCli

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

ChaosCli is used to interact with server master, fake job and provides ways to adding chaos in e2e test.

func NewUTCli

func NewUTCli(ctx context.Context, masterAddrs, businessMetaAddrs []string, project tenant.ProjectInfo,
	cfg *FakeJobConfig,
) (*ChaosCli, error)

NewUTCli creates a new ChaosCli instance

func (*ChaosCli) CancelJob

func (cli *ChaosCli) CancelJob(ctx context.Context, jobID string) error

CancelJob sends CancelJob command to servermaster

func (*ChaosCli) CheckFakeJobKey

func (cli *ChaosCli) CheckFakeJobKey(
	ctx context.Context, masterID string, jobIndex int, expectedMvcc int, expectedValue string,
) error

CheckFakeJobKey queries the checkpoint of a fake job, checks the value and mvcc count are as expected. If error happens or check is not passed, return error.

func (*ChaosCli) CheckFakeJobTick

func (cli *ChaosCli) CheckFakeJobTick(
	ctx context.Context, masterID string, jobIndex int, target int64,
) error

CheckFakeJobTick queries the checkpoint of a fake job and checks the tick count is as expected.

func (*ChaosCli) CheckJobStatus

func (cli *ChaosCli) CheckJobStatus(
	ctx context.Context, jobID string, expectedStatus pb.Job_State,
) (bool, error)

CheckJobStatus checks job status is as expected.

func (*ChaosCli) ContainerRestart

func (cli *ChaosCli) ContainerRestart(name string)

ContainerRestart restarts a docker container

func (*ChaosCli) ContainerStart

func (cli *ChaosCli) ContainerStart(name string)

ContainerStart starts a docker container

func (*ChaosCli) ContainerStop

func (cli *ChaosCli) ContainerStop(name string)

ContainerStop stops a docker container

func (*ChaosCli) CreateJob

func (cli *ChaosCli) CreateJob(ctx context.Context, jobType pb.Job_Type, config []byte) (string, error)

CreateJob sends SubmitJob command to servermaster

func (*ChaosCli) GetLeaderAddr

func (cli *ChaosCli) GetLeaderAddr(ctx context.Context) (string, error)

GetLeaderAddr gets the address of the leader of the server master.

func (*ChaosCli) GetRevision

func (cli *ChaosCli) GetRevision(ctx context.Context) (int64, error)

GetRevision puts a key gets the latest revision of etcd cluster

func (*ChaosCli) InitializeMetaClient

func (cli *ChaosCli) InitializeMetaClient(jobID string) error

InitializeMetaClient initializes the business kvclient

func (*ChaosCli) ResignLeader

func (cli *ChaosCli) ResignLeader(ctx context.Context, addr string) error

ResignLeader resigns the leader at the given addr.

func (*ChaosCli) UpdateFakeJobKey

func (cli *ChaosCli) UpdateFakeJobKey(ctx context.Context, id int, value string) error

UpdateFakeJobKey updates the etcd value of a worker belonging to a fake job

type FakeJobConfig

type FakeJobConfig struct {
	EtcdEndpoints []string
	WorkerCount   int
	KeyPrefix     string
}

FakeJobConfig is used to construct a fake job configuration

Jump to

Keyboard shortcuts

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