MCPcopy Create free account
hub / github.com/riverqueue/river / WorkJob

Method WorkJob

rivertest/worker.go:124–127  ·  view source on GitHub ↗

WorkJob works an existing job already in the database. The job must be inserted using external logic prior to calling this method. The transaction is used for all work-related database operations so that the caller can easily roll back at the end of the test to maintain a clean database state. The

(ctx context.Context, tb testing.TB, tx TTx, job *rivertype.JobRow)

Source from the content-addressed store, hash-verified

122// The returned error only reflects _real_ errors and does not include
123// explicitly returned snooze or cancel errors from the worker.
124func (w *Worker[T, TTx]) WorkJob(ctx context.Context, tb testing.TB, tx TTx, job *rivertype.JobRow) (*WorkResult, error) {
125 tb.Helper()
126 return w.workJob(ctx, tb, tx, job)
127}
128
129func (w *Worker[T, TTx]) workJob(ctx context.Context, tb testing.TB, tx TTx, job *rivertype.JobRow) (*WorkResult, error) {
130 tb.Helper()

Callers 3

WorkMethod · 0.95
TestMiddlewareFunction · 0.80
TestWorker_WorkJobFunction · 0.80

Calls 2

workJobMethod · 0.95
HelperMethod · 0.65

Tested by 2

TestMiddlewareFunction · 0.64
TestWorker_WorkJobFunction · 0.64