Skip to content

Commit 7b2d4bb

Browse files
committed
chore: add healthcheck to coherence
1 parent 9dc93a5 commit 7b2d4bb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

coherence/coherence_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ const (
2828
coherenceImageEnvVar string = "TEST_COHERENCE_IMAGE"
2929
coherencePort = "1408/tcp"
3030
coherencePort2 = "30000/tcp"
31+
32+
// configuration for the health check
33+
coherenceHealthEnvVar = "COHERENCE_HEALTH_HTTP_PORT"
34+
coherenceHealthPort = "6676"
3135
)
3236

3337
func newTestConfig(t testing.TB) Config {
@@ -42,10 +46,15 @@ func newTestConfig(t testing.TB) Config {
4246

4347
c, err := testcontainers.Run(ctx,
4448
img,
45-
testcontainers.WithExposedPorts(coherencePort, coherencePort2),
49+
testcontainers.WithExposedPorts(coherencePort, coherencePort2, coherenceHealthPort),
50+
testcontainers.WithEnv(map[string]string{
51+
coherenceHealthEnvVar: coherenceHealthPort,
52+
}),
4653
testcontainers.WithWaitStrategy(
4754
wait.ForListeningPort(coherencePort),
4855
wait.ForListeningPort(coherencePort2),
56+
wait.ForListeningPort(coherenceHealthPort+"/tcp"),
57+
wait.ForHTTP("/ready").WithPort(coherenceHealthPort+"/tcp").WithStartupTimeout(time.Second*30),
4958
),
5059
)
5160
testcontainers.CleanupContainer(t, c)

0 commit comments

Comments
 (0)