Documentation
¶
Overview ¶
Package factory contains helpers for instantiating tests.
Index ¶
- Variables
- func CreateArchivedJob(t *testing.T, data json.RawMessage, status newmodels.ArchivedJobStatus) *newmodels.ArchivedJob
- func CreateAtMostOnceJob(t *testing.T, data json.RawMessage) (*newmodels.Job, *newmodels.QueuedJob)
- func CreateJob(t testing.TB, j newmodels.CreateJobParams) newmodels.Job
- func CreateQJ(t testing.TB) *newmodels.QueuedJob
- func CreateQueuedJob(t testing.TB, data json.RawMessage) *newmodels.QueuedJob
- func CreateQueuedJobOnly(t testing.TB, name string, data json.RawMessage)
- func CreateUniqueQueuedJob(t testing.TB, data json.RawMessage) (*newmodels.Job, *newmodels.QueuedJob)
- func Processor(url string) *services.JobProcessor
- func RandomId(prefix string) types.PrefixUUID
- type RandomData
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyData = json.RawMessage([]byte("{}"))
View Source
var JobId types.PrefixUUID
View Source
var RD = &RandomData{ Foo: []string{"bar", "pik_345"}, Baz: uint8(17), }
View Source
var SampleAtMostOnceJob = newmodels.CreateJobParams{ Name: "at-most-once", DeliveryStrategy: newmodels.DeliveryStrategyAtMostOnce, Attempts: 1, Concurrency: 5, }
View Source
var SampleJob = newmodels.CreateJobParams{ Name: "echo", DeliveryStrategy: newmodels.DeliveryStrategyAtLeastOnce, Attempts: 7, Concurrency: 1, }
Functions ¶
func CreateArchivedJob ¶
func CreateArchivedJob(t *testing.T, data json.RawMessage, status newmodels.ArchivedJobStatus) *newmodels.ArchivedJob
func CreateAtMostOnceJob ¶
CreateAtMostOnceJob creates a queued job that can be run at most once.
func CreateQueuedJob ¶
CreateQueuedJob creates a job and a queued job with the given JSON data, and returns the created queued job.
Example ¶
t := &testing.T{} CreateQueuedJob(t, EmptyData)
Output:
func CreateQueuedJobOnly ¶
func CreateQueuedJobOnly(t testing.TB, name string, data json.RawMessage)
func CreateUniqueQueuedJob ¶
func CreateUniqueQueuedJob(t testing.TB, data json.RawMessage) (*newmodels.Job, *newmodels.QueuedJob)
Like the above but with unique ID's and job names
func Processor ¶
func Processor(url string) *services.JobProcessor
Processor returns a simple JobProcessor, with a client pointing at the given URL, password set to "password" and various sleeps set to 0.
Types ¶
type RandomData ¶
Click to show internal directories.
Click to hide internal directories.