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

Function Test_Client_QueueListTx

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

Source from the content-addressed store, hash-verified

6496}
6497
6498func Test_Client_QueueListTx(t *testing.T) {
6499 t.Parallel()
6500
6501 ctx := context.Background()
6502
6503 type testBundle struct {
6504 executorTx riverdriver.ExecutorTx
6505 schema string
6506 tx pgx.Tx
6507 }
6508
6509 setup := func(t *testing.T) (*Client[pgx.Tx], *testBundle) {
6510 t.Helper()
6511
6512 var (
6513 dbPool = riversharedtest.DBPool(ctx, t)
6514 driver = riverpgxv5.New(dbPool)
6515 schema = riverdbtest.TestSchema(ctx, t, driver, nil)
6516 config = newTestConfig(t, schema)
6517 client = newTestClient(t, dbPool, config)
6518 )
6519
6520 tx, err := dbPool.Begin(ctx)
6521 require.NoError(t, err)
6522 t.Cleanup(func() { tx.Rollback(ctx) })
6523
6524 return client, &testBundle{
6525 executorTx: client.driver.UnwrapExecutor(tx),
6526 schema: schema,
6527 tx: tx,
6528 }
6529 }
6530
6531 t.Run("ListsQueues", func(t *testing.T) {
6532 t.Parallel()
6533
6534 client, bundle := setup(t)
6535
6536 listRes, err := client.QueueListTx(ctx, bundle.tx, NewQueueListParams())
6537 require.NoError(t, err)
6538 require.Empty(t, listRes.Queues)
6539
6540 queue := testfactory.Queue(ctx, t, bundle.executorTx, &testfactory.QueueOpts{Schema: bundle.schema})
6541
6542 listRes, err = client.QueueListTx(ctx, bundle.tx, NewQueueListParams())
6543 require.NoError(t, err)
6544 require.Len(t, listRes.Queues, 1)
6545 require.Equal(t, queue.Name, listRes.Queues[0].Name)
6546
6547 // Not visible outside of transaction.
6548 listRes, err = client.QueueList(ctx, NewQueueListParams())
6549 require.NoError(t, err)
6550 require.Empty(t, listRes.Queues)
6551 })
6552}
6553
6554func Test_Client_QueueUpdate(t *testing.T) {
6555 t.Parallel()

Callers

nothing calls this directly

Calls 15

DBPoolFunction · 0.92
NewFunction · 0.92
TestSchemaFunction · 0.92
QueueFunction · 0.92
newTestClientFunction · 0.85
NewQueueListParamsFunction · 0.85
CleanupMethod · 0.80
QueueListTxMethod · 0.80
newTestConfigFunction · 0.70
HelperMethod · 0.65
BeginMethod · 0.65
RollbackMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…