Skip to content

Commit

Permalink
internal: add missing exposed port for mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
jzelinskie committed Jul 3, 2023
1 parent 4474adc commit d7a83bb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions internal/testserver/datastore/mysql.go
Expand Up @@ -21,6 +21,7 @@ import (

const (
mysqlPort = 3306
mysqlPortStr = "3306/tcp"
defaultCreds = "root:secret"
testDBPrefix = "spicedb_test_"
)
Expand Down Expand Up @@ -59,11 +60,12 @@ func RunMySQLForTestingWithOptions(t testing.TB, options MySQLTesterOptions, bri

name := fmt.Sprintf("mysql-%s", uuid.New().String())
resource, err := pool.RunWithOptions(&dockertest.RunOptions{
Name: name,
Repository: "mysql",
Tag: containerImageTag,
Platform: "linux/amd64", // required because the mysql:5 image does not have arm support
Env: []string{"MYSQL_ROOT_PASSWORD=secret"},
Name: name,
Repository: "mysql",
Tag: containerImageTag,
Platform: "linux/amd64", // required because the mysql:5 image does not have arm support
Env: []string{"MYSQL_ROOT_PASSWORD=secret"},
ExposedPorts: []string{mysqlPortStr},
// increase max connections (default 151) to accommodate tests using the same docker container
Cmd: []string{"--max-connections=500"},
NetworkID: bridgeNetworkName,
Expand All @@ -78,7 +80,7 @@ func RunMySQLForTestingWithOptions(t testing.TB, options MySQLTesterOptions, bri
require.NoError(t, pool.Purge(resource))
})

port := resource.GetPort(fmt.Sprintf("%d/tcp", mysqlPort))
port := resource.GetPort(mysqlPortStr)
if bridgeNetworkName != "" {
builder.hostname = name
builder.port = fmt.Sprintf("%d", mysqlPort)
Expand Down

0 comments on commit d7a83bb

Please sign in to comment.