Skip to content

Commit 1ce0b62

Browse files
aparajonsvc-squareup-copybara
authored andcommitted
Target localhost in VitessTestDb Docker health check
GitOrigin-RevId: bb0e81326795138f9e934e9fbb713d7650b3ce1e
1 parent 43bcba0 commit 1ce0b62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: misk-vitess/src/testFixtures/kotlin/misk/vitess/testing/internal/VitessDockerContainer.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ internal class VitessDockerContainer(
5959
const val READONLY_COUNT =
6060
-1 // Set to -1 to actually set the read-only count to 0. This overrides a defaults issue in the vtcombo codebase.
6161

62+
const val DOCKER_HEALTH_CHECK_HOST = "localhost"
6263
const val DOCKER_START_RETRIES = 6
6364
const val DOCKER_START_RETRY_DELAY_MS = 5000L
6465
const val CONTAINER_START_RETRIES = 10
@@ -338,12 +339,13 @@ internal class VitessDockerContainer(
338339
!debugStartup // If `debugStartup` is `true`, we keep the container running to inspect logs.
339340
) // Otherwise, remove container when it stops.
340341

342+
// The health check is run from the Docker daemon, so it needs to target localhost.
341343
val healthCheck =
342344
HealthCheck()
343345
.withTest(
344346
listOf(
345347
"CMD-SHELL",
346-
"mysql -h ${vitessClusterConfig.hostname} --protocol=tcp -P ${vitessClusterConfig.vtgatePort} -u=${vitessClusterConfig.vtgateUser} --execute 'USE @primary;'",
348+
"mysql -h $DOCKER_HEALTH_CHECK_HOST --protocol=tcp -P ${vitessClusterConfig.vtgatePort} -u=${vitessClusterConfig.vtgateUser} --execute 'USE @primary;'",
347349
)
348350
)
349351
.withInterval(Duration.ofSeconds(CONTAINER_HEALTH_CHECK_INTERVAL_SECONDS).toNanos())

0 commit comments

Comments
 (0)