job

package
v0.190.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

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

The different states that a job can be in.

View Source
const (
	StatePassed = "passed"
	StateFailed = "failed"
)

The following states are only used by RDC.

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 AppSettings added in v0.93.0

type AppSettings struct {
	AudioCapture    bool            `json:"audio_capture,omitempty"`
	Instrumentation Instrumentation `json:"instrumentation,omitempty"`
}

AppSettings represents app settings for real device

type Instrumentation added in v0.93.0

type Instrumentation struct {
	NetworkCapture bool `json:"network_capture,omitempty"`
}

Instrumentation represents instrumentation settings for real device

type Job added in v0.21.1

type Job struct {
	ID     string
	Name   string
	Passed bool
	Status string
	Error  string

	BrowserName    string
	BrowserVersion string

	DeviceName string

	Framework string

	OS        string
	OSVersion string

	// IsRDC flags a job started as an RDC run.
	IsRDC bool

	// TimedOut flags a job as an unfinished one.
	TimedOut bool

	URL string
}

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).

func (Job) TotalStatus added in v0.75.0

func (j Job) TotalStatus() string

TotalStatus returns the total status of a job, combining the result of fields Status + Passed.

type Service added in v0.99.2

type Service interface {
	// StartJob starts a new Job.
	StartJob(ctx context.Context, opts StartOptions) (Job, error)

	// StopJob stops a running Job.
	StopJob(ctx context.Context, jobID string, realDevice bool) (Job, error)

	// Job returns the Job details.
	Job(ctx context.Context, id string, realDevice bool) (Job, error)

	// PollJob polls Job details at an interval, until timeout or until the Job
	// has ended, whichever occurs first.
	PollJob(ctx context.Context, id string, interval, timeout time.Duration, realDevice bool) (Job, error)

	// Artifact returns the content of the artifact.
	Artifact(ctx context.Context, jobID, fileName string, realDevice bool) ([]byte, error)

	// ArtifactNames returns the names of the artifact files associated with a
	// job.
	ArtifactNames(ctx context.Context, jobID string, realDevice bool) ([]string, error)

	// UploadArtifact uploads an artifact to the Job that matches the given jobID.
	UploadArtifact(ctx context.Context, jobID string, realDevice bool, fileName string, contentType string, content []byte) error

	// DownloadArtifacts downloads artifacts from a Job. Returns a list of
	// file paths.
	DownloadArtifacts(job Job, isLastAttempt bool) []string
}

Service represents the interface for Job interactions.

type SmartRetry added in v0.130.0

type SmartRetry struct {
	FailedOnly bool `json:"-"`
}

SmartRetry represents the retry strategy.

type Source added in v0.173.0

type Source string

Source represents the origin of a job.

const (
	SourceAny Source = ""    // Unknown origin.
	SourceVDC Source = "vdc" // Virtual Device Cloud
	SourceRDC Source = "rdc" // Real Device Cloud
	SourceAPI Source = "api" // API Fortress
)

type StartOptions

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

	// PrevAttempts contains any previous attempts of the job.
	PrevAttempts []report.Attempt `json:"-"`

	// Timeout is used for local/per-suite timeout.
	Timeout   time.Duration `json:"-"`
	StartTime time.Time     `json:"startTime,omitempty"`

	User      string `json:"username"`
	AccessKey string `json:"accessKey"`

	App       string   `json:"app,omitempty"`
	OtherApps []string `json:"otherApps,omitempty"`

	Suite string `json:"suite,omitempty"`

	// FrameworkVersion contains the targeted version of the framework.
	// It should not be confused with RunnerVersion.
	FrameworkVersion string `json:"frameworkVersion,omitempty"`
	Framework        string `json:"framework,omitempty"`

	PlatformName    string `json:"platformName,omitempty"`
	PlatformVersion string `json:"platformVersion,omitempty"`

	NodeVersion string `json:"nodeVersion,omitempty"`

	Tunnel TunnelOptions `json:"tunnel,omitempty"`

	Experiments map[string]string `json:"experiments,omitempty"`

	Name  string   `json:"name,omitempty"`
	Build string   `json:"build,omitempty"`
	Tags  []string `json:"tags,omitempty"`

	Visibility string `json:"public,omitempty"`

	Attempt          int `json:"-"`
	CurrentPassCount int `json:"-"`
	PassThreshold    int `json:"-"`

	Retries    int        `json:"-"`
	SmartRetry SmartRetry `json:"-"`

	BrowserName      string `json:"browserName,omitempty"`
	BrowserVersion   string `json:"browserVersion,omitempty"`
	TimeZone         string `json:"timeZone,omitempty"`
	RunnerVersion    string `json:"runnerVersion,omitempty"`
	ScreenResolution string `json:"screenResolution,omitempty"`

	TestApp           string                 `json:"testApp,omitempty"`
	DeviceName        string                 `json:"deviceName,omitempty"`
	DeviceOrientation string                 `json:"deviceOrientation"`
	TestOptions       map[string]interface{} `json:"testOptions,omitempty"`

	AppSettings       AppSettings `json:"appSettings,omitempty"`
	DeviceID          string      `json:"deviceId,omitempty"`
	DeviceHasCarrier  bool        `json:"deviceHasCarrier,omitempty"`
	DevicePrivateOnly bool        `json:"devicePrivateOnly,omitempty"`
	DeviceType        string      `json:"deviceType,omitempty"`
	RealDevice        bool        `json:"realDevice,omitempty"`
	TestsToRun        []string    `json:"testsToRun,omitempty"`
	TestsToSkip       []string    `json:"testsToSkip,omitempty"`
	RealDeviceKind    string      `json:"realDeviceKind,omitempty"`

	ARMRequired bool              `json:"armRequired,omitempty"`
	Env         map[string]string `json:"-"`

	ConfigFilePath string                 `json:"-"`
	CLIFlags       map[string]interface{} `json:"-"`
}

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

type TunnelOptions added in v0.22.0

type TunnelOptions struct {
	Name  string `json:"name"`
	Owner string `json:"owner,omitempty"`
}

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

Jump to

Keyboard shortcuts

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