(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestClientDriverPlugin(t *testing.T) { |
| 20 | t.Parallel() |
| 21 | |
| 22 | ctx := context.Background() |
| 23 | |
| 24 | type testBundle struct { |
| 25 | pluginDriver *TestDriverWithPlugin |
| 26 | } |
| 27 | |
| 28 | setup := func(t *testing.T) (*Client[pgx.Tx], *testBundle) { |
| 29 | t.Helper() |
| 30 | |
| 31 | var ( |
| 32 | dbPool = riversharedtest.DBPool(ctx, t) |
| 33 | driver = riverpgxv5.New(dbPool) |
| 34 | schema = riverdbtest.TestSchema(ctx, t, driver, nil) |
| 35 | config = newTestConfig(t, schema) |
| 36 | ) |
| 37 | |
| 38 | pluginDriver := newDriverWithPlugin(t, dbPool) |
| 39 | |
| 40 | client, err := NewClient(pluginDriver, config) |
| 41 | require.NoError(t, err) |
| 42 | |
| 43 | return client, &testBundle{ |
| 44 | pluginDriver: pluginDriver, |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | t.Run("InitCalled", func(t *testing.T) { |
| 49 | t.Parallel() |
| 50 | |
| 51 | client, bundle := setup(t) |
| 52 | |
| 53 | startClient(ctx, t, client) |
| 54 | |
| 55 | require.True(t, bundle.pluginDriver.initCalled) |
| 56 | }) |
| 57 | } |
| 58 | |
| 59 | var _ driverPlugin[pgx.Tx] = &TestDriverWithPlugin{} |
| 60 |
nothing calls this directly
no test coverage detected
searching dependent graphs…