From 3d65d3ef8c0b82b479e17c861ecc8aa58dff48c0 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 23 Dec 2024 12:05:02 -0700 Subject: [PATCH] Bypass testcontainers --- test/test_internals/deps.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_internals/deps.go b/test/test_internals/deps.go index 4c3343d9..c0f0478e 100644 --- a/test/test_internals/deps.go +++ b/test/test_internals/deps.go @@ -115,11 +115,13 @@ func MakeTestDeps() (*ContainerDeps, error) { } // we can hardcode the port and most of the connection details because we're behind the docker network here pgConnStr := fmt.Sprintf("host=%s port=5432 user=postgres password=test1234 dbname=mmr sslmode=disable", pgHost) - //extPgConnStr, err := pgContainer.ConnectionString(ctx, "sslmode=disable") - extPgConnStr := pgConnStr + // the external connection string is a bit harder, because testcontainers wants to use `localhost` as a hostname, + // which prevents us from using the ConnectionString() function. We instead build the connection string manually + pgExtPort, err := pgContainer.MappedPort(ctx, "5432/tcp") if err != nil { return nil, err } + extPgConnStr := fmt.Sprintf("host=%s port=%d user=postgres password=test1234 dbname=mmr sslmode=disable", pgHost, pgExtPort.Int()) // Start a redis container cwd, err := os.Getwd()