Skip to content

Commit

Permalink
compare_test: check for backends being ready
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
rafiss committed Mar 28, 2021
1 parent bd6b86d commit 0c9c86c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions pkg/compose/compare/compare/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pkg/compose/compare/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0c9c86c

Please sign in to comment.