e2eutil

package
v0.12.10 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MPL-2.0 Imports: 15 Imported by: 226

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentRestart added in v0.10.0

func AgentRestart(client *api.Client, nodeID string) (string, error)

AgentRestart is a test helper function that restarts a client node running under systemd using a raw_exec job. Returns the job ID of the restart job so that callers can clean it up.

func AllocIDsFromAllocationListStubs added in v0.10.4

func AllocIDsFromAllocationListStubs(allocs []*api.AllocationListStub) []string

func AllocLogs added in v0.12.10

func AllocLogs(allocID string, logStream LogStream) (string, error)

func AllocTaskLogs added in v0.12.10

func AllocTaskLogs(allocID, task string, logStream LogStream) (string, error)

func CheckServicesPassing deprecated added in v0.12.1

func CheckServicesPassing(t *testing.T, agentAPI *consulapi.Agent, allocIDs []string)

CheckServicesPassing scans for passing agent checks via the given agent API client.

Deprecated: not useful in e2e, where more than one node exists and Nomad jobs are placed non-deterministically. The Consul agentAPI only knows about what is registered on its node, and cannot be used to query for cluster wide state.

func Command added in v0.12.10

func Command(cmd string, args ...string) (string, error)

Command sends a command line argument to Nomad and returns the unbuffered stdout as a string (or, if there's an error, the stderr)

func DeploymentsForJob added in v0.9.3

func DeploymentsForJob(t *testing.T, nomadClient *api.Client, jobID string) []*api.Deployment

func ListLinuxClientNodes added in v0.10.4

func ListLinuxClientNodes(client *api.Client) ([]string, error)

ListLinuxClientNodes returns a list of Linux client IDs, so that tests can skip operating-specific tests if there are no Linux clients available Returns an error only on client errors.

func ListWindowsClientNodes added in v0.10.4

func ListWindowsClientNodes(client *api.Client) ([]string, error)

ListWindowsClientNodes returns a list of Windows client IDs, so that tests can skip operating-specific tests if there are no Windows clients available. Returns an error only on client errors.

func RegisterAllocs added in v0.9.2

func RegisterAllocs(t *testing.T, nomadClient *api.Client, jobFile, jobID, cToken string) []*api.AllocationListStub

func RegisterAndWaitForAllocs

func RegisterAndWaitForAllocs(t *testing.T, nomadClient *api.Client, jobFile, jobID, cToken string) []*api.AllocationListStub

RegisterAndWaitForAllocs wraps RegisterAllocs but blocks until Evals successfully create Allocs.

func RequireConsulDeregistered added in v0.10.0

func RequireConsulDeregistered(require *require.Assertions,
	client *capi.Client, serviceName string)

RequireConsulDeregistered asserts that the service eventually is deregistered from Consul

func RequireConsulStatus added in v0.10.0

func RequireConsulStatus(require *require.Assertions,
	client *capi.Client, serviceName, expectedStatus string)

RequireConsulStatus asserts the aggregate health of the service converges to the expected status

func WaitForAllocNotPending added in v0.10.4

func WaitForAllocNotPending(t *testing.T, nomadClient *api.Client, allocID string)

func WaitForAllocRunning

func WaitForAllocRunning(t *testing.T, nomadClient *api.Client, allocID string)

func WaitForAllocStopped added in v0.11.0

func WaitForAllocStopped(t *testing.T, nomadClient *api.Client, allocID string)

func WaitForAllocTaskRunning added in v0.12.10

func WaitForAllocTaskRunning(t *testing.T, nomadClient *api.Client, allocID, task string)

func WaitForAllocsNotPending added in v0.10.4

func WaitForAllocsNotPending(t *testing.T, nomadClient *api.Client, allocIDs []string)

func WaitForAllocsRunning added in v0.10.4

func WaitForAllocsRunning(t *testing.T, nomadClient *api.Client, allocIDs []string)

func WaitForDeployment added in v0.9.2

func WaitForDeployment(t *testing.T, nomadClient *api.Client, deployID string, status string, statusDesc string)

func WaitForJobStopped added in v0.12.4

func WaitForJobStopped(t *testing.T, nomadClient *api.Client, job string)

WaitForJobStopped stops a job and waits for all of its allocs to terminate.

func WaitForLeader

func WaitForLeader(t *testing.T, nomadClient *api.Client)

func WaitForNodesReady

func WaitForNodesReady(t *testing.T, nomadClient *api.Client, nodes int)

WaitForNodesReady waits until at least `nodes` number of nodes are ready or fails the test.

Types

type LogStream added in v0.12.10

type LogStream int
const (
	LogsStdErr LogStream = iota
	LogsStdOut
)

Jump to

Keyboard shortcuts

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