Skip to content

Commit

Permalink
MySQL liveness check port numbers were missing
Browse files Browse the repository at this point in the history
  • Loading branch information
aidando73 committed Aug 18, 2022
1 parent 4b68ef3 commit 4612773
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.testcontainers.utility.DockerImageName;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
Expand Down Expand Up @@ -56,12 +57,6 @@ public MySQLContainer(final DockerImageName dockerImageName) {
addExposedPort(MYSQL_PORT);
}

@NotNull
@Override
protected Set<Integer> getLivenessCheckPorts() {
return new HashSet<>(getMappedPort(MYSQL_PORT));
}

@Override
protected void configure() {
optionallyMapResourceParameterAsVolume(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,16 @@ public void testWithAdditionalUrlParamInJdbcUrl() {
mysql.stop();
}
}

@Test
public void testExposedAndLivenessCheckPorts() {
try (
MySQLContainer<?> mysql = new MySQLContainer<>(MySQLTestImages.MYSQL_57_IMAGE)
.withLogConsumer(new Slf4jLogConsumer(logger));
) {
mysql.start();
assertThat(mysql.getExposedPorts()).containsExactly(MySQLContainer.MYSQL_PORT);
assertThat(mysql.getLivenessCheckPortNumbers()).containsExactly(mysql.getMappedPort(MySQLContainer.MYSQL_PORT));
}
}
}

0 comments on commit 4612773

Please sign in to comment.