Documentation ¶
Overview ¶
Package factory contains helpers for instantiating tests.
Index ¶
- Variables
- func CreateArchivedJob(t *testing.T, data json.RawMessage, status models.JobStatus) *models.ArchivedJob
- func CreateAtMostOnceJob(t *testing.T, data json.RawMessage) (*models.Job, *models.QueuedJob)
- func CreateJob(t testing.TB, j models.Job) models.Job
- func CreateQJ(t testing.TB) *models.QueuedJob
- func CreateQueuedJob(t testing.TB, data json.RawMessage) *models.QueuedJob
- func CreateQueuedJobOnly(t testing.TB, name string, data json.RawMessage) *models.QueuedJob
- func CreateUniqueQueuedJob(t testing.TB, data json.RawMessage) (*models.Job, *models.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 = models.Job{ Name: "at-most-once", DeliveryStrategy: models.StrategyAtMostOnce, Attempts: 1, Concurrency: 5, }
View Source
var SampleJob = models.Job{ Name: "echo", DeliveryStrategy: models.StrategyAtLeastOnce, Attempts: 7, Concurrency: 1, }
Functions ¶
func CreateArchivedJob ¶
func CreateArchivedJob(t *testing.T, data json.RawMessage, status models.JobStatus) *models.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 CreateUniqueQueuedJob ¶
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, and various sleeps set to 0.
Types ¶
type RandomData ¶
Click to show internal directories.
Click to hide internal directories.