Skip to content

Commit b79c9f8

Browse files
ensure the port is open before starting the tests
1 parent 5f4e842 commit b79c9f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

componenttest/rdapp_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
rdapp "github.com/kishaningithub/rdapp/pkg"
1010
"github.com/stretchr/testify/require"
1111
"go.uber.org/zap"
12+
"net"
1213
"testing"
1314
"time"
1415
)
@@ -31,6 +32,11 @@ func TestRedshiftDataApiPostgresProxy(t *testing.T) {
3132
require.NoError(t, err)
3233
}()
3334

35+
require.Eventually(t, func() bool {
36+
_, err := net.Dial("tcp", listenAddress)
37+
return err == nil
38+
}, 10*time.Second, 10*time.Millisecond, "port is not open")
39+
3440
databaseUrl := "postgres://postgres:mypassword@localhost:35432/postgres"
3541
conn, err := sql.Open("pgx", databaseUrl)
3642
require.NoError(t, err)

0 commit comments

Comments
 (0)