Skip to content

Commit b123226

Browse files
committed
Make MySQL wait strategy less flaky
Removed the `wait.ForExposedPort()` override from test files. The tests will now use the MySQL module's default wait strategy (`wait.ForLog("port: 3306 MySQL Community Server")`), which properly waits for MySQL to be ready to accept connections. Otherwise the port may be exposed, but MySQL is still initializing and not ready to accept connections.
1 parent 560b69d commit b123226

3 files changed

Lines changed: 0 additions & 6 deletions

File tree

go/logic/applier_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/github/gh-ost/go/binlog"
2424
"github.com/github/gh-ost/go/mysql"
2525
"github.com/github/gh-ost/go/sql"
26-
"github.com/testcontainers/testcontainers-go/wait"
2726
)
2827

2928
func TestApplierGenerateSqlModeQuery(t *testing.T) {
@@ -213,7 +212,6 @@ func (suite *ApplierTestSuite) SetupSuite() {
213212
testmysql.WithDatabase(testMysqlDatabase),
214213
testmysql.WithUsername(testMysqlUser),
215214
testmysql.WithPassword(testMysqlPass),
216-
testcontainers.WithWaitStrategy(wait.ForExposedPort()),
217215
testmysql.WithConfigFile("my.cnf.test"),
218216
)
219217
suite.Require().NoError(err)

go/logic/migrator_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"github.com/github/gh-ost/go/mysql"
3333
"github.com/github/gh-ost/go/sql"
3434
"github.com/testcontainers/testcontainers-go"
35-
"github.com/testcontainers/testcontainers-go/wait"
3635
)
3736

3837
func TestMigratorOnChangelogEvent(t *testing.T) {
@@ -302,7 +301,6 @@ func (suite *MigratorTestSuite) SetupSuite() {
302301
testmysql.WithDatabase(testMysqlDatabase),
303302
testmysql.WithUsername(testMysqlUser),
304303
testmysql.WithPassword(testMysqlPass),
305-
testcontainers.WithWaitStrategy(wait.ForExposedPort()),
306304
testmysql.WithConfigFile("my.cnf.test"),
307305
)
308306
suite.Require().NoError(err)

go/logic/streamer_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/testcontainers/testcontainers-go"
1414
"github.com/testcontainers/testcontainers-go/modules/mysql"
1515

16-
"github.com/testcontainers/testcontainers-go/wait"
1716
"golang.org/x/sync/errgroup"
1817
)
1918

@@ -31,7 +30,6 @@ func (suite *EventsStreamerTestSuite) SetupSuite() {
3130
mysql.WithDatabase(testMysqlDatabase),
3231
mysql.WithUsername(testMysqlUser),
3332
mysql.WithPassword(testMysqlPass),
34-
testcontainers.WithWaitStrategy(wait.ForExposedPort()),
3533
)
3634
suite.Require().NoError(err)
3735

0 commit comments

Comments
 (0)