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)
| 122 | // The returned error only reflects _real_ errors and does not include |
| 123 | // explicitly returned snooze or cancel errors from the worker. |
| 124 | func (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 | |
| 129 | func (w *Worker[T, TTx]) workJob(ctx context.Context, tb testing.TB, tx TTx, job *rivertype.JobRow) (*WorkResult, error) { |
| 130 | tb.Helper() |