From 0c9c86c5706846040fee3cc449eb0111f5d9ab6e Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Fri, 26 Mar 2021 18:03:20 -0400 Subject: [PATCH] compare_test: check for backends being ready Release note: None --- pkg/compose/compare/compare/compare_test.go | 13 +++++++++++++ pkg/compose/compare/docker-compose.yml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/compose/compare/compare/compare_test.go b/pkg/compose/compare/compare/compare_test.go index 3a1e7c72cc29..a58b05932b93 100644 --- a/pkg/compose/compare/compare/compare_test.go +++ b/pkg/compose/compare/compare/compare_test.go @@ -27,7 +27,9 @@ import ( "github.com/cockroachdb/cockroach/pkg/internal/sqlsmith" "github.com/cockroachdb/cockroach/pkg/sql/mutations" "github.com/cockroachdb/cockroach/pkg/sql/rowenc" + "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/randutil" + "github.com/jackc/pgx/v4" ) var ( @@ -102,6 +104,17 @@ func TestCompare(t *testing.T) { } ctx := context.Background() + + // docker-compose requires us to manually check for when a container + // is ready to receive connections. + // See https://docs.docker.com/compose/startup-order/ + for name, uri := range uris { + testutils.SucceedsSoon(t, func() error { + _, err := pgx.Connect(ctx, uri.addr) + return err + }) + } + for confName, config := range configs { t.Run(confName, func(t *testing.T) { rng, _ := randutil.NewPseudoRand() diff --git a/pkg/compose/compare/docker-compose.yml b/pkg/compose/compare/docker-compose.yml index 2fb9c2b1d10c..b1cc7b4ef872 100644 --- a/pkg/compose/compare/docker-compose.yml +++ b/pkg/compose/compare/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: postgres: - image: postgis/postgis:11-3.0 + image: postgis/postgis:13-3.1 environment: - POSTGRES_INITDB_ARGS=--locale=C - POSTGRES_HOST_AUTH_METHOD=trust