MCPcopy Index your code
hub / github.com/coder/coder / TestPostgresBackend

Function TestPostgresBackend

enterprise/audit/backends/postgres_test.go:16–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestPostgresBackend(t *testing.T) {
17 t.Parallel()
18 t.Run("OK", func(t *testing.T) {
19 t.Parallel()
20
21 var (
22 ctx, cancel = context.WithCancel(context.Background())
23 db, _ = dbtestutil.NewDB(t)
24 pgb = backends.NewPostgres(db, true)
25 alog = audittest.RandomLog()
26 )
27 defer cancel()
28
29 err := pgb.Export(ctx, alog, audit.BackendDetails{})
30 require.NoError(t, err)
31
32 got, err := db.GetAuditLogsOffset(ctx, database.GetAuditLogsOffsetParams{
33 OffsetOpt: 0,
34 LimitOpt: 1,
35 })
36 require.NoError(t, err)
37 require.Len(t, got, 1)
38 require.Equal(t, alog.ID, got[0].AuditLog.ID)
39 })
40}

Callers

nothing calls this directly

Calls 8

NewDBFunction · 0.92
NewPostgresFunction · 0.92
RandomLogFunction · 0.92
RunMethod · 0.65
ExportMethod · 0.65
GetAuditLogsOffsetMethod · 0.65
LenMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected