Documentation ¶
Index ¶
- func AgentRestart(client *api.Client, nodeID string) (string, error)
- func AllocExec(allocID, taskID, execCmd, ns string, wc *WaitConfig) (string, error)
- func AllocIDsFromAllocationListStubs(allocs []*api.AllocationListStub) []string
- func AllocStatuses(jobID, ns string) ([]string, error)
- func AllocStatusesRescheduled(jobID, ns string) ([]string, error)
- func AllocsForJob(jobID, ns string) ([]map[string]string, error)
- func AllocsForNode(nodeID string) ([]map[string]string, error)
- func CheckServicesPassing(t *testing.T, agentAPI *consulapi.Agent, allocIDs []string)deprecated
- func Command(cmd string, args ...string) (string, error)
- func DeploymentsForJob(t *testing.T, nomadClient *api.Client, jobID string) []*api.Deployment
- func GetField(output, key string) (string, error)
- func GetSection(output, key string) (string, error)
- func LastDeploymentID(jobID, ns string) (string, error)
- func ListLinuxClientNodes(client *api.Client) ([]string, error)
- func ListWindowsClientNodes(client *api.Client) ([]string, error)
- func NewE2EJob(jobfile string) framework.TestCase
- func NodeStatusList() ([]map[string]string, error)
- func NodeStatusListFiltered(filterFn func(string) bool) ([]map[string]string, error)
- func ParseColumns(section string) ([]map[string]string, error)
- func ParseFields(section string) (map[string]string, error)
- func Register(jobID, jobFilePath string) error
- func RegisterAllocs(t *testing.T, nomadClient *api.Client, jobFile, jobID, cToken string) []*api.AllocationListStub
- func RegisterAndWaitForAllocs(t *testing.T, nomadClient *api.Client, jobFile, jobID, cToken string) []*api.AllocationListStub
- func RegisterFromJobspec(jobID, jobspec string) error
- func RequireConsulDeregistered(require *require.Assertions, client *capi.Client, serviceName string)
- func RequireConsulStatus(require *require.Assertions, client *capi.Client, ...)
- func WaitForAllocFile(allocID, path string, test func(string) bool, wc *WaitConfig) error
- func WaitForAllocNotPending(t *testing.T, nomadClient *api.Client, allocID string)
- func WaitForAllocRunning(t *testing.T, nomadClient *api.Client, allocID string)
- func WaitForAllocStatusComparison(query func() ([]string, error), comparison func([]string) bool, wc *WaitConfig) error
- func WaitForAllocStatusExpected(jobID, ns string, expected []string) error
- func WaitForAllocStopped(t *testing.T, nomadClient *api.Client, allocID string)
- func WaitForAllocsNotPending(t *testing.T, nomadClient *api.Client, allocIDs []string)
- func WaitForAllocsRunning(t *testing.T, nomadClient *api.Client, allocIDs []string)
- func WaitForDeployment(t *testing.T, nomadClient *api.Client, deployID string, status string, ...)
- func WaitForJobStopped(t *testing.T, nomadClient *api.Client, job string)
- func WaitForLastDeploymentStatus(jobID, ns, status string, wc *WaitConfig) error
- func WaitForLeader(t *testing.T, nomadClient *api.Client)
- func WaitForNodesReady(t *testing.T, nomadClient *api.Client, nodes int)
- type WaitConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentRestart ¶ added in v0.10.0
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 AllocExec ¶ added in v1.0.0
func AllocExec(allocID, taskID, execCmd, ns string, wc *WaitConfig) (string, error)
AllocExec is a convenience wrapper that runs 'nomad alloc exec' with the passed execCmd via '/bin/sh -c', retrying if the task isn't ready
func AllocIDsFromAllocationListStubs ¶ added in v0.10.4
func AllocIDsFromAllocationListStubs(allocs []*api.AllocationListStub) []string
func AllocStatuses ¶ added in v1.0.0
AllocStatuses returns a slice of client statuses
func AllocStatusesRescheduled ¶ added in v1.0.0
AllocStatusesRescheduled is a helper function that pulls out client statuses only from rescheduled allocs.
func AllocsForJob ¶ added in v1.0.0
AllocsForJob returns a slice of key->value maps, each describing the values of the 'nomad job status' Allocations section (not actual structs.Allocation objects, query the API if you want those)
func AllocsForNode ¶ added in v1.0.0
AllocsForNode returns a slice of key->value maps, each describing the values of the 'nomad node status' Allocations section (not actual structs.Allocation objects, query the API if you want those)
func CheckServicesPassing
deprecated
added in
v0.12.1
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
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 GetField ¶ added in v1.0.0
GetField returns the value of an output field (ex. the "Submit Date" field of `nomad job status :id`)
func GetSection ¶ added in v1.0.0
GetSection returns a section, with its field header but without its title. (ex. the Allocations section of `nomad job status :id`)
func LastDeploymentID ¶ added in v1.0.0
func ListLinuxClientNodes ¶ added in v0.10.4
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
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 NodeStatusList ¶ added in v1.0.0
func NodeStatusListFiltered ¶ added in v1.0.0
func ParseColumns ¶ added in v1.0.0
ParseColumns maps the CLI output for a columized section (without title) to a slice of key->value pairs for each row in that section. (ex. the Allocations section of `nomad job status :id`)
func ParseFields ¶ added in v1.0.0
ParseFields maps the CLI output for a key-value section (without title) to map of the key->value pairs in that section (ex. the Latest Deployment section of `nomad job status :id`)
func Register ¶ added in v1.0.0
Register registers a jobspec from a file but with a unique ID. The caller is responsible for recording that ID for later cleanup.
func RegisterAllocs ¶ added in v0.9.2
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 RegisterFromJobspec ¶ added in v1.0.0
Register registers a jobspec from a string, also with a unique ID. The caller is responsible for recording that ID for later cleanup.
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 WaitForAllocFile ¶ added in v1.0.0
func WaitForAllocFile(allocID, path string, test func(string) bool, wc *WaitConfig) error
WaitForAllocFile is a helper that grabs a file via alloc fs and tests its contents; useful for checking the results of rendered templates
func WaitForAllocNotPending ¶ added in v0.10.4
func WaitForAllocRunning ¶
func WaitForAllocStatusComparison ¶ added in v1.0.0
func WaitForAllocStatusComparison(query func() ([]string, error), comparison func([]string) bool, wc *WaitConfig) error
WaitForAllocStatusComparison is a convenience wrapper that polls the query function until the comparison function returns true.
func WaitForAllocStatusExpected ¶ added in v1.0.0
WaitForAllocStatusExpected polls 'nomad job status' and exactly compares the status of all allocations (including any previous versions) against the expected list.
func WaitForAllocStopped ¶ added in v0.11.0
func WaitForAllocsNotPending ¶ added in v0.10.4
func WaitForAllocsRunning ¶ added in v0.10.4
func WaitForDeployment ¶ added in v0.9.2
func WaitForJobStopped ¶ added in v0.12.4
WaitForJobStopped stops a job and waits for all of its allocs to terminate.
func WaitForLastDeploymentStatus ¶ added in v1.0.0
func WaitForLastDeploymentStatus(jobID, ns, status string, wc *WaitConfig) error
Types ¶
type WaitConfig ¶ added in v1.0.0
WaitConfig is an interval and wait time that can be passed to a waiter function, but with a default value that comes from the OrDefault method if the config is nil