Files
mesh-controller/internal/store/fortest_test.go
T
jschoubben 185d0294eb
mesh/merge-gate head 185d0294ebd4 merged into trunk 89abce5df955 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; the ch…
mesh/repo-check head 185d0294ebd4 merged into trunk 89abce5df955 — pass: its merge-check.sh passed
mesh/delivery covered after its stop: a later merge that contains it was delivered: novox/mesh-controller@0b312218f90f (merged as 791786d5 into main, wal…
mesh/check pass 185d0294ebd4 on 89abce5df955 | unit 1756 run, 0 kept, 4 skipped | integration 3034 run, 0 kept, 16 skipped | over bound: integration (…
Keep the store address's query in every test database's address, so store tests reach a socket-addressed store (issue 1889)
The checker's integration store answers on a unix socket named in the query of MESH_TEST_POSTGRES
(?host=<socket dir>&sslmode=disable). The identity, inventory and licences fixtures cut the address at
its last slash and appended ?sslmode=disable, dropping host=, so pgx dialled its default socket where no
server is: every store test waited out its 20 s readiness bound, each package ran into go test's
10-minute timeout, and the verdict named only the first failure,
identity.TestACertificateChainsToTheMeshsOwnAuthority.

store.DatabaseForTest now builds that address for every fixture, keeping the query as the template raise
already did; identity's fresh is ForTest rather than a second copy. The readiness bound and its error,
which wraps the driver's cause, are unchanged.
2026-10-23 08:55:50 +02:00

26 lines
1.1 KiB
Go

package store
import "testing"
// 1889/AC1: the checker's integration store answers on a unix socket named in the address's query
// (mesh-build-go's store). A test database's address that drops the query reaches pgx's default socket,
// where no server is, and every store test waits out its 20 s and fails.
func TestATestDatabaseIsOnTheSocketItsAdminAddressNames(t *testing.T) {
admin := "postgres://postgres@/postgres?host=%2Fwork%2Frun-1%2Fpg%2Fsocket&sslmode=disable"
got := DatabaseForTest(admin, "ident_1_x")
want := "postgres://postgres@/ident_1_x?host=%2Fwork%2Frun-1%2Fpg%2Fsocket&sslmode=disable"
if got != want {
t.Fatalf("the test database's address is %q, want %q", got, want)
}
}
// 1889/AC2: the address `make check` gives (TCP, with sslmode) builds what the fixtures always built.
func TestATestDatabaseOnTCPIsAddressedAsBefore(t *testing.T) {
admin := "postgres://postgres:check@127.0.0.1:55566/postgres?sslmode=disable"
got := DatabaseForTest(admin, "inv_2_y")
want := "postgres://postgres:check@127.0.0.1:55566/inv_2_y?sslmode=disable"
if got != want {
t.Fatalf("the test database's address is %q, want %q", got, want)
}
}