job

package
v0.48.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateNew        = "new"
	StateQueued     = "queued"
	StateInProgress = "in progress"
	StateComplete   = "complete"
	StateError      = "error"

	StatePassed = "passed"
	StateFailed = "failed"
)

The different states that a job can be in.

View Source
const (
	RDCTypeDynamicDeviceQuery   = "DynamicDeviceQuery"
	RDCTypeHardcodedDeviceQuery = "HardcodedDeviceQuery"
)

The different device selectors possible for a RDC Job.

Variables

DoneStates represents states that a job doesn't transition out of, i.e. once the job is in one of these states, it's done.

Functions

func Done added in v0.21.1

func Done(status string) bool

Done returns true if the job status is one of DoneStates. False otherwise.

Types

type Job added in v0.21.1

type Job struct {
	ID         string `json:"id"`
	Passed     bool   `json:"passed"`
	Status     string `json:"status"`
	Error      string `json:"error"`
	BaseConfig struct {
		PlatformName    string `json:"platformName"`
		PlatformVersion string `json:"platformVersion"`
		DeviceName      string `json:"deviceName"`
	} `json:"base_config"`

	// IsRDC flags a job started as a RDC run.
	IsRDC bool `json:"-"`
}

Job represents test details and metadata of a test run (aka Job), that is usually associated with a particular test execution instance (e.g. VM).

type RDCDeviceQuery added in v0.43.0

type RDCDeviceQuery struct {
	Type               string `json:"type,omitempty"`
	DeviceDescriptorID string `json:"device_descriptor_id,omitempty"`
	RequestDeviceType  string `json:"requested_device_type,omitempty"`
}

RDCDeviceQuery represents the device query for RDC tests.

type RDCStarter added in v0.43.0

type RDCStarter interface {
	StartJob(opts RDCStarterOptions) (string, error)
}

RDCStarter is the interface for starting jobs on RDC

type RDCStarterOptions added in v0.43.0

type RDCStarterOptions struct {
	TestFramework string            `json:"test_framework"`
	AppID         string            `json:"app_id"`
	TestAppID     string            `json:"test_app_id"`
	DeviceQuery   RDCDeviceQuery    `json:"device_query,omitempty"`
	TestOptions   map[string]string `json:"test_options,omitempty"`
	TestName      string            `json:"test_name,omitempty"`
}

RDCStarterOptions represents the options for starting a job on RDC Cloud.

type Reader added in v0.21.1

type Reader interface {
	// ReadJob returns the job details.
	ReadJob(ctx context.Context, id string) (Job, error)

	// PollJob polls job details at an interval, until the job has ended, whether successfully or due to an error.
	PollJob(ctx context.Context, id string, interval time.Duration) (Job, error)

	// GetJobAssetFileNames returns all assets files available.
	GetJobAssetFileNames(ctx context.Context, jobID string) ([]string, error)

	// GetJobAssetFileContent returns the job asset file content.
	GetJobAssetFileContent(ctx context.Context, jobID, fileName string) ([]byte, error)
}

Reader is the interface for retrieving jobs.

type StartOptions

type StartOptions struct {
	// DisplayName is used for local logging purposes only (e.g. console).
	DisplayName string `json:"-"`

	User           string `json:"username"`
	AccessKey      string `json:"accessKey"`
	App            string `json:"app,omitempty"`
	Suite          string `json:"suite,omitempty"`
	Framework      string `json:"framework,omitempty"`
	ConfigFilePath string `json:"-"`

	// FrameworkVersion contains the targeted version of the framework
	// It should not be confused with automation tool (like jest/folio).
	// This is currently supported only for frameworks available on Sauce Cloud:
	// Currently supported: Cypress.
	FrameworkVersion string `json:"frameworkVersion,omitempty"`

	BrowserName       string            `json:"browserName,omitempty"`
	BrowserVersion    string            `json:"browserVersion,omitempty"`
	PlatformName      string            `json:"platformName,omitempty"`
	PlatformVersion   string            `json:"platformVersion,omitempty"`
	DeviceID          string            `json:"deviceId,omitempty"`
	DeviceName        string            `json:"deviceName,omitempty"`
	DeviceOrientation string            `json:"deviceOrientation"`
	DevicePrivateOnly bool              `json:"devicePrivateOnly,omitempty"`
	DeviceType        string            `json:"deviceType,omitempty"`
	DeviceHasCarrier  bool              `json:"deviceHasCarrier,omitempty"`
	RealDevice        bool              `json:"realDevice,omitempty"`
	Name              string            `json:"name,omitempty"`
	Build             string            `json:"build,omitempty"`
	Tags              []string          `json:"tags,omitempty"`
	Tunnel            TunnelOptions     `json:"tunnel,omitempty"`
	ScreenResolution  string            `json:"screenResolution,omitempty"`
	RunnerVersion     string            `json:"runnerVersion,omitempty"`
	Experiments       map[string]string `json:"experiments,omitempty"`
	TestOptions       TestOptions       `json:"testOptions,omitempty"`
	TestsToRun        []string          `json:"testsToRun,omitempty"`
}

StartOptions represents the options for starting a job in the Sauce Labs cloud.

type Starter

type Starter interface {
	StartJob(ctx context.Context, opts StartOptions) (jobID string, isRDC bool, err error)
}

Starter is the interface for starting jobs.

type Stopper added in v0.35.0

type Stopper interface {
	StopJob(ctx context.Context, jobID string) (Job, error)
}

Stopper is the interface for stopping jobs.

type TestOptions added in v0.37.0

type TestOptions struct {
	NotClass   []string `yaml:"notClass,omitempty" json:"notClass"`
	Class      []string `yaml:"class,omitempty" json:"class"`
	Package    string   `yaml:"package,omitempty" json:"package"`
	Size       string   `yaml:"size,omitempty" json:"size"`
	Annotation string   `yaml:"annotation,omitempty" json:"annotation"`
	ShardIndex *int     `yaml:"shardIndex,omitempty" json:"shardIndex"`
	NumShards  *int     `yaml:"numShards,omitempty" json:"numShards"`
}

TestOptions represents the espresso test filter options configuration.

type TunnelOptions added in v0.22.0

type TunnelOptions struct {
	ID     string `json:"id"`
	Parent string `json:"parent,omitempty"`
}

TunnelOptions represents the options that configure the usage of a tunnel when running tests in the Sauce Labs cloud.

type Writer added in v0.37.1

type Writer interface {
	UploadAsset(jobID string, fileName string, contentType string, content []byte) error
}

Writer is the interface for modifying jobs.

Jump to

Keyboard shortcuts

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