Documentation ¶
Overview ¶
Package workertest provides a framework for declarative definition of worker integration tests.
Index ¶
- func AllOfArtifact(assertions ...func(t *testing.T, a Artifact)) func(t *testing.T, a Artifact)
- func AnyArtifact() func(t *testing.T, a Artifact)
- func ErrorArtifact() func(t *testing.T, a Artifact)
- func GrepArtifact(substring string) func(t *testing.T, a Artifact)
- func LogArtifact() func(t *testing.T, a Artifact)
- func MatchArtifact(body, contentType string) func(t *testing.T, a Artifact)
- func NotGrepArtifact(substring string) func(t *testing.T, a Artifact)
- func ReferenceArtifact() func(t *testing.T, a Artifact)
- func S3Artifact() func(t *testing.T, a Artifact)
- type Artifact
- type ArtifactAssertions
- type Case
- type Environment
- type SetupFunc
- type StatusAssertion
- type Task
- type TasksFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllOfArtifact ¶ added in v0.1.17
AllOfArtifact creates an assertion that checks all assertions given
func AnyArtifact ¶
AnyArtifact creates an assertion that checks matches anything.
func ErrorArtifact ¶
ErrorArtifact creates an assertion that holds if the artifact is an error artifact
func GrepArtifact ¶
GrepArtifact creates an assertion that holds if the artifact contains the given substring.
func LogArtifact ¶ added in v0.1.1
LogArtifact creates an assetion that logs the artifact, to test log. This is mostly useful when developing integration tests.
func MatchArtifact ¶ added in v0.1.1
MatchArtifact creates an assertion that holds if the artifact body matches given body and has the given contentType
func NotGrepArtifact ¶ added in v0.1.12
NotGrepArtifact creates an assertion that holds if the artifact does not contain the given substring.
func ReferenceArtifact ¶
ReferenceArtifact creates an assertion that holds if the artifact is a reference artifact
func S3Artifact ¶
S3Artifact creates an assertion that holds if the artifact is an S3 artifact
Types ¶
type Artifact ¶
type Artifact struct { ContentType string Expires time.Time Name string StorageType string Data []byte ContentEncoding string }
Artifact contains artifact meta-data.
type ArtifactAssertions ¶
An ArtifactAssertions is a mapping from artifact name to assertion for the artifact. If mapping to nil value, any artifact will be permitted.
type Case ¶
type Case struct { Engine string // Engine to be used EngineConfig string // Engine configuration as JSON PluginConfig string // Configuration of plugins, see plugins.PluginManagerConfigSchema() Setup SetupFunc // Function to setup local environment, return a cleanup function Tasks TasksFunc // Function that returns a list of tasks to create and associated assertions Concurrency int // Worker concurrency, if zero defaulted to 1 and tasks will sequantially dependent StoppedGracefully bool // True, if worker is expected to stop gracefully StoppedNow bool // True, if worker is expected to stop now Timeout time.Duration // Test timeout, defaults to 8 Minutes EnableSuperseding bool // Enable superseding in the worker }
Case is a worker test case
func (Case) TestWithFakeQueue ¶
TestWithFakeQueue runs integration tests against FakeQueue
func (Case) TestWithRealQueue ¶
TestWithRealQueue runs integration tests against production queue
type Environment ¶ added in v0.1.16
type Environment struct { Worker runtime.Stoppable Queue *tcqueue.Queue Listener fakequeue.Listener }
Environment holds values that can be accessed in callbacks
type SetupFunc ¶ added in v0.1.16
type SetupFunc func(t *testing.T, env Environment) func()
A SetupFunc callback can setup the local environment, this includes starting servers running on localhost. The SetupFunc callback returns a cleanup function that will be invoked when tests are done.
type StatusAssertion ¶
A StatusAssertion is a function that can make an assertion on a task status
type Task ¶
type Task struct { TaskID string // Optional taskID (use slugid.Nice()) Title string // Optional title (for debugging) Scopes []string // Task scopes Payload string // Task payload as JSON IgnoreState bool // Ignore Success and Exception Success bool // True, if task should be successfully Exception runtime.ExceptionReason // Reason, if exception is expected Artifacts ArtifactAssertions // Mapping from artifact name to assertion AllowAdditional bool // True, if additional artifacts is allowed Status StatusAssertion // Optional, custom assertion on status and queue }
A Task to be included in a worker test case
Directories ¶
Path | Synopsis |
---|---|
Package fakequeue provides a fake implementation of taskcluster-queue in golang, The FakeQueue server stores tasks in-memory, it doesn't validate authentication, but implements most end-points correctly.
|
Package fakequeue provides a fake implementation of taskcluster-queue in golang, The FakeQueue server stores tasks in-memory, it doesn't validate authentication, but implements most end-points correctly. |