Added this failing test case as skipped while working on another project, detecting a problem that the test case above was glossing over, but finding it not easy to fix so decided to punt. An initial Stop is called on the client with a cancelled context, but then Stop is called again with a non-can
(t *testing.T)
| 2398 | // |
| 2399 | // TODO: Remove the Skip below and fix the problem. |
| 2400 | func Test_Client_Stop_AfterContextCancelled(t *testing.T) { |
| 2401 | t.Parallel() |
| 2402 | |
| 2403 | t.Skip("this test case was added broken and should be fixed") |
| 2404 | |
| 2405 | ctx := context.Background() |
| 2406 | |
| 2407 | var ( |
| 2408 | dbPool = riversharedtest.DBPool(ctx, t) |
| 2409 | driver = riverpgxv5.New(dbPool) |
| 2410 | schema = riverdbtest.TestSchema(ctx, t, driver, nil) |
| 2411 | config = newTestConfig(t, schema) |
| 2412 | ) |
| 2413 | config.Schema = schema |
| 2414 | |
| 2415 | type JobArgs struct { |
| 2416 | testutil.JobArgsReflectKind[JobArgs] |
| 2417 | } |
| 2418 | |
| 2419 | // doneCh will never close, job will exit due to context cancellation: |
| 2420 | var ( |
| 2421 | doneCh = make(chan struct{}) |
| 2422 | startedCh = make(chan int64) |
| 2423 | ) |
| 2424 | AddWorker(config.Workers, makeAwaitWorker[JobArgs](startedCh, doneCh)) |
| 2425 | |
| 2426 | client := newTestClient(t, dbPool, config) |
| 2427 | subscribeChan := subscribe(t, client) |
| 2428 | |
| 2429 | startClient(ctx, t, client) |
| 2430 | |
| 2431 | insertRes, err := client.Insert(ctx, JobArgs{}, nil) |
| 2432 | require.NoError(t, err) |
| 2433 | event := riversharedtest.WaitOrTimeout(t, subscribeChan) |
| 2434 | require.Equal(t, insertRes.Job.ID, event.Job.ID) |
| 2435 | |
| 2436 | ctx, cancel := context.WithCancel(ctx) |
| 2437 | cancel() |
| 2438 | |
| 2439 | require.ErrorIs(t, client.Stop(ctx), context.Canceled) |
| 2440 | } |
| 2441 | |
| 2442 | func Test_Client_StopAndCancel(t *testing.T) { |
| 2443 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…