Skip to content

Commit 1ff7101

Browse files
authored
Fix MinIO wait strategy (#7901)
Currently, log strategy is defined. Switching to HTTP strategy to `/minio/health/live` endpoint for reliability. Fixes #7892
1 parent 892b06b commit 1ff7101

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

modules/minio/src/main/java/org/testcontainers/containers/MinIOContainer.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public MinIOContainer(final String dockerImageName) {
4848
public MinIOContainer(final DockerImageName dockerImageName) {
4949
super(dockerImageName);
5050
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
51+
withExposedPorts(MINIO_S3_PORT, MINIO_UI_PORT);
52+
withCommand("server", "--console-address", ":" + MINIO_UI_PORT, "/data");
53+
waitingFor(
54+
Wait
55+
.forHttp("/minio/health/live")
56+
.forPort(MINIO_S3_PORT)
57+
.withStartupTimeout(Duration.of(60, ChronoUnit.SECONDS))
58+
);
5159
}
5260

5361
/**
@@ -75,8 +83,6 @@ public MinIOContainer withPassword(String password) {
7583
*/
7684
@Override
7785
public void configure() {
78-
withExposedPorts(MinIOContainer.MINIO_S3_PORT, MinIOContainer.MINIO_UI_PORT);
79-
8086
if (this.userName != null) {
8187
addEnv("MINIO_ROOT_USER", this.userName);
8288
} else {
@@ -87,14 +93,6 @@ public void configure() {
8793
} else {
8894
this.password = DEFAULT_PASSWORD;
8995
}
90-
91-
withCommand("server", "--console-address", ":" + MINIO_UI_PORT, "/data");
92-
93-
waitingFor(
94-
Wait
95-
.forLogMessage(".*Status: 1 Online, 0 Offline..*", 1)
96-
.withStartupTimeout(Duration.of(60, ChronoUnit.SECONDS))
97-
);
9896
}
9997

10098
/**

0 commit comments

Comments
 (0)