diff --git a/server/cmd/server/integration_test.go b/server/cmd/server/integration_test.go index a879d3c1..a0cee2f3 100644 --- a/server/cmd/server/integration_test.go +++ b/server/cmd/server/integration_test.go @@ -49,6 +49,11 @@ func TestMain(m *testing.M) { fmt.Printf("Skipping integration tests: could not connect to database: %v\n", err) os.Exit(0) } + if err := pool.Ping(ctx); err != nil { + fmt.Printf("Skipping integration tests: database not reachable: %v\n", err) + pool.Close() + os.Exit(0) + } testPool = pool testUserID, testWorkspaceID, err = setupIntegrationTestFixture(ctx, pool) diff --git a/server/internal/handler/handler_test.go b/server/internal/handler/handler_test.go index db65ea19..3251482b 100644 --- a/server/internal/handler/handler_test.go +++ b/server/internal/handler/handler_test.go @@ -41,6 +41,11 @@ func TestMain(m *testing.M) { fmt.Printf("Skipping tests: could not connect to database: %v\n", err) os.Exit(0) } + if err := pool.Ping(ctx); err != nil { + fmt.Printf("Skipping tests: database not reachable: %v\n", err) + pool.Close() + os.Exit(0) + } queries := db.New(pool) hub := realtime.NewHub()