testhelpers

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLocalTestCluster

func CreateLocalTestCluster() (*setup.Cmds, error)

Spins up a new Local Test Cluster in a separate goroutine. Returns the associated Cmds. To Kill the cluster run Kill() on return Cmds

func CreateScootClient

func CreateScootClient(addr string) *client.CloudScootClient

Creates a CloudScootClient that talks to the specified address

func GenJobDefinition

func GenJobDefinition(rng *rand.Rand, numTasks int, snapshotID string) *scoot.JobDefinition

Generates a scoot.JobDefinition with numTasks tasks (or random if numTasks == -1)

func GenJobId

func GenJobId(rng *rand.Rand) string

Generates a valid random JobId

func GenRandomAlphaNumericString

func GenRandomAlphaNumericString(rng *rand.Rand) string

Generates an AlphaNumericString of random length (0, 21]

func GenTask

func GenTask(rng *rand.Rand, taskID, snapshotID string) *scoot.TaskDefinition

Generates a scoot.TaskDefinition TODO: actually make more realistic

func GenTaskId

func GenTaskId(rng *rand.Rand) string

Generates a valid random TaskID

func GenerateJob

func GenerateJob(numTasks int, snapshotID string) *scoot.JobDefinition

Generates a random Job and sends it to the specified client to run returns the JobId if successfully scheduled, otherwise "", error

func InstallBinaries

func InstallBinaries() error

func IsJobCompleted

func IsJobCompleted(s *scoot.JobStatus) bool

Returns true if a job is completed or failed, false otherwise

func KillAndExit1

func KillAndExit1(cmds *setup.Cmds, err error)

func NewRand

func NewRand() *rand.Rand

generates a new random number seeded with

func PrintJobs

func PrintJobs(jobs map[string]*scoot.JobStatus)

Prints the current status of the specified Jobs to the Log

func StartJob

func StartJob(client *client.CloudScootClient, job *scoot.JobDefinition) string

func WaitForClusterToBeReady

func WaitForClusterToBeReady(client scoot.CloudScoot)

Blocks until the cluster is ready, by pinging the GetStatus Api Until a successful response is returned.

func WaitForJobsToCompleteAndLogStatus

func WaitForJobsToCompleteAndLogStatus(
	jobIds []string,
	client scoot.CloudScoot,
	timeout time.Duration,
) error

Waits until all jobs specified have completed running or the specified timeout has occurred. Periodically the status of running jobs is printed to the console

Types

This section is empty.

Jump to

Keyboard shortcuts

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