Skip to content

Commit

Permalink
[hotfix] Fix deprecated methods for containers (#3706)
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneguow authored Jul 9, 2024
1 parent 7c423f0 commit be474d6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private Map<String, TopicDescription> describeExternalTopics() {
.filter(listing -> !listing.isInternal())
.map(TopicListing::name)
.collect(Collectors.toList());
return adminClient.describeTopics(topics).all().get();
return adminClient.describeTopics(topics).allTopicNames().get();
} catch (Exception e) {
throw new RuntimeException("Failed to list Kafka topics", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,10 @@ public String executeCommandFileInDatabase(
}

public String getConnectionString() {
return String.format(
"mongodb://%s:%d", getContainerIpAddress(), getMappedPort(MONGODB_PORT));
return String.format("mongodb://%s:%d", getHost(), getMappedPort(MONGODB_PORT));
}

public String getHostAndPort() {
return String.format("%s:%s", getContainerIpAddress(), getMappedPort(MONGODB_PORT));
return String.format("%s:%s", getHost(), getMappedPort(MONGODB_PORT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ public MySqlContainer(MySqlVersion version) {
}

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

@Override
protected void configure() {
optionallyMapResourceParameterAsVolume(
MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/", "mysql-default-conf");
MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/", "mysql-default-conf", null);

if (parameters.containsKey(SETUP_SQL_PARAM_NAME)) {
optionallyMapResourceParameterAsVolume(
SETUP_SQL_PARAM_NAME, "/docker-entrypoint-initdb.d/", "N/A");
SETUP_SQL_PARAM_NAME, "/docker-entrypoint-initdb.d/", "N/A", null);
}

addEnv("MYSQL_DATABASE", databaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PostgresContainer(DockerImageName dockerImageName) {
protected void configure() {
if (parameters.containsKey(SETUP_SQL_PARAM_NAME)) {
optionallyMapResourceParameterAsVolume(
SETUP_SQL_PARAM_NAME, "/docker-entrypoint-initdb.d/", "N/A");
SETUP_SQL_PARAM_NAME, "/docker-entrypoint-initdb.d/", "N/A", null);
}
super.configure();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.testcontainers.containers.Network;
import org.testcontainers.containers.PulsarContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -75,6 +76,8 @@ public class PulsarActionITCaseBase extends CdcActionITCaseBase {
private static final Network NETWORK = Network.newNetwork();
private static final String INTER_CONTAINER_PULSAR_ALIAS = "pulsar";

public static final String IMAGE = "apachepulsar/pulsar";

private final ObjectMapper objectMapper = new ObjectMapper();

private PulsarAdmin admin;
Expand All @@ -87,7 +90,7 @@ public class PulsarActionITCaseBase extends CdcActionITCaseBase {

private static PulsarContainerExtension createPulsarContainerExtension() {
PulsarContainerExtension container =
new PulsarContainerExtension("3.0.0") {
new PulsarContainerExtension(DockerImageName.parse(IMAGE + ":" + "3.0.0")) {
@Override
protected void doStart() {
super.doStart();
Expand Down Expand Up @@ -284,8 +287,8 @@ public PulsarSyncDatabaseActionBuilder(Map<String, String> pulsarConfig) {
/** Pulsar container extension for junit5. */
private static class PulsarContainerExtension extends PulsarContainer
implements BeforeAllCallback, AfterAllCallback {
private PulsarContainerExtension(String pulsarVersion) {
super(pulsarVersion);
private PulsarContainerExtension(DockerImageName dockerImageName) {
super(dockerImageName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private Map<String, TopicDescription> describeExternalTopics() {
.map(TopicListing::name)
.collect(Collectors.toList());

return adminClient.describeTopics(topics).all().get();
return adminClient.describeTopics(topics).allTopicNames().get();
} catch (Exception e) {
throw new RuntimeException("Failed to list Kafka topics", e);
}
Expand Down

0 comments on commit be474d6

Please sign in to comment.