Documentation
¶
Overview ¶
Package pgtest holds shared test-only helpers for pgvector store integration tests (analogous in spirit to stdlib's net/http/httptest: a dedicated test-support package, never imported by production code).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RestoreDSNs ¶
RestoreDSNs reads the two DSNs an ownership-transfer restore-simulation test needs and skips the test if either is unset:
- DATABASE_URL: the role the store under test connects as (the "app" role).
- OWNERSHIP_TEST_ADMIN_DSN: a different, already-privileged role that stands in for the pg_restore-time role and pre-creates the table.
func SimulateRestore ¶
func SimulateRestore(ctx context.Context, t *testing.T, adminDSN, schemaSQL, table string) (adminPool *pgxpool.Pool, ownerBefore string)
SimulateRestore connects as adminDSN, refuses to run against anything but an obvious throwaway test/CI database (guards against DROPping a real table if OWNERSHIP_TEST_ADMIN_DSN is ever pointed at a live DB), then (re)creates table via schemaSQL under the admin role — mirroring a superuser pg_restore that leaves the table owned by the restoring role.
Returns the admin pool (closed automatically via t.Cleanup) and the table's owner immediately after creation, for the caller to compare against the owner after exercising the store's init path.
Types ¶
This section is empty.