MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestDB

Function TestDB

internal/testutil/db.go:52–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestDB(t *testing.T) *pgxpool.Pool {
53 t.Helper()
54
55 ctx := context.Background()
56 pool, err := OpenPreparedTestDB(ctx, TestDBURL())
57 if err != nil {
58 t.Skipf("test database not available: %v", err)
59 }
60
61 t.Cleanup(func() {
62 TruncateAll(t, pool)
63 pool.Close()
64 })
65
66 return pool
67}
68
69func TruncateAll(t *testing.T, pool *pgxpool.Pool) {
70 t.Helper()

Calls 5

OpenPreparedTestDBFunction · 0.85
TestDBURLFunction · 0.85
TruncateAllFunction · 0.85
CleanupMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected