test

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestTask

func NewTestTask(name string) (task *tcqueue.TaskDefinitionRequest, workerType string)

NewTestTask generates a task definition for the given test name. This task definition is typically then further refined, before being sumbitted to the queue via a call to SubmitTask(...). It will also generate and return a unique (slug) workerType for this task, and this task only. This is useful for being able to run multiple tasks in parallel, and being confident that the worker instance that was started to run this task, is the one that receives it.

func RunTestWorker

func RunTestWorker(workerType string)

RunTestWorker will start up the taskcluster-worker, claim one task, and then return. This is useful in integration tests, such that tests can submit a real task to the queue, then call this function to execute the task, and then query the queue to get task results.

func SubmitTask

func SubmitTask(
	t *testing.T,
	td *tcqueue.TaskDefinitionRequest,
	payload TaskPayload,
) (taskID string, q *tcqueue.Queue)

SubmitTask will submit a real task to the production queue, if at least environment variables TASKCLUSTER_CLIENT_ID and TASKCLUSTER_ACCESS_TOKEN have been set in the current process (TASKCLUSTER_CERTIFICATE is also respected, but not required). It will return a reference to the queue and the taskID used, in order that the caller can query the queue for results, if required.

Types

type TaskPayload

type TaskPayload struct {
	// Artifacts to be published
	Artifacts []struct {
		Expires tcclient.Time `json:"expires,omitempty"`

		// This will be the leading path to directories and the full name for
		// files that are uploaded to s3. It must not begin or end with "/" and
		// must only contain printable ascii characters otherwise.
		//
		// Syntax:     ^([\x20-\x2e\x30-\x7e][\x20-\x7e]*)[\x20-\x2e\x30-\x7e]$
		Name string `json:"name"`

		// File system path of artifact
		//
		// Syntax:     ^.*[^/]$
		Path string `json:"path"`

		// Artifacts can be either an individual `file` or a `directory`
		// containing potentially multiple files with recursively included
		// subdirectories
		//
		// Possible values:
		//   * "file"
		//   * "directory"
		Type string `json:"type"`
	} `json:"artifacts,omitempty"`

	// Command to execute
	Command []string `json:"command"`

	// Optional URL for a gzipped tar-ball to be downloaded and extracted in
	// the HOME directory for running the command.
	Context string `json:"context,omitempty"`

	// Mapping from environment variables to values
	Env json.RawMessage `json:"env,omitempty"`

	// If true, reboot the machine after task is finished.
	Reboot bool `json:"reboot,omitempty"`
}

TaskPayload is generated from running `taskcluster-worker schema payload [options] <config.yml>` and then passing the results through github.com/taskcluster/jsonschema2go. It represents the structure expected when using the test config.yml

Directories

Path Synopsis
Package nativetest provides integration tests for a few common configuration of native and common plugins.
Package nativetest provides integration tests for a few common configuration of native and common plugins.

Jump to

Keyboard shortcuts

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