MCPcopy Index your code
hub / github.com/riverqueue/river / Test_Client_JobUpdate

Function Test_Client_JobUpdate

client_test.go:5266–5375  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5264}
5265
5266func Test_Client_JobUpdate(t *testing.T) {
5267 t.Parallel()
5268
5269 ctx := context.Background()
5270
5271 type testBundle struct {
5272 dbPool *pgxpool.Pool
5273 }
5274
5275 setup := func(t *testing.T) (*Client[pgx.Tx], *testBundle) {
5276 t.Helper()
5277
5278 var (
5279 dbPool = riversharedtest.DBPool(ctx, t)
5280 driver = riverpgxv5.New(dbPool)
5281 schema = riverdbtest.TestSchema(ctx, t, driver, nil)
5282 config = newTestConfig(t, schema)
5283 client = newTestClient(t, dbPool, config)
5284 )
5285
5286 return client, &testBundle{dbPool: dbPool}
5287 }
5288
5289 t.Run("AllParams", func(t *testing.T) {
5290 t.Parallel()
5291
5292 client, _ := setup(t)
5293
5294 insertRes, err := client.Insert(ctx, noOpArgs{}, &InsertOpts{})
5295 require.NoError(t, err)
5296
5297 job, err := client.JobUpdate(ctx, insertRes.Job.ID, &JobUpdateParams{
5298 Output: "my job output",
5299 })
5300 require.NoError(t, err)
5301 require.Equal(t, `"my job output"`, string(job.Output()))
5302
5303 updatedJob, err := client.JobGet(ctx, job.ID)
5304 require.NoError(t, err)
5305 require.Equal(t, `"my job output"`, string(updatedJob.Output()))
5306 })
5307
5308 t.Run("NoParams", func(t *testing.T) {
5309 t.Parallel()
5310
5311 client, _ := setup(t)
5312
5313 insertRes, err := client.Insert(ctx, noOpArgs{}, &InsertOpts{})
5314 require.NoError(t, err)
5315
5316 _, err = client.JobUpdate(ctx, insertRes.Job.ID, nil)
5317 require.NoError(t, err)
5318 })
5319
5320 t.Run("OutputFromContext", func(t *testing.T) {
5321 t.Parallel()
5322
5323 client, _ := setup(t)

Callers

nothing calls this directly

Calls 12

DBPoolFunction · 0.92
NewFunction · 0.92
TestSchemaFunction · 0.92
newTestClientFunction · 0.85
RecordOutputFunction · 0.85
InsertMethod · 0.80
OutputMethod · 0.80
JobGetMethod · 0.80
newTestConfigFunction · 0.70
HelperMethod · 0.65
RunMethod · 0.65
JobUpdateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…