Skip to content

Commit 4e58132

Browse files
committed
Revert to using a fixed host/address for the connect instance due to multiple port allocation issues on GH actions
1 parent 78e0dc2 commit 4e58132

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/services/kafka/EmbeddedKafkaService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.concurrent.TimeUnit;
2424

2525
import org.apache.camel.kafkaconnector.common.PluginPathHelper;
26-
import org.apache.camel.kafkaconnector.common.utils.NetworkUtils;
2726
import org.apache.camel.test.infra.kafka.services.KafkaService;
2827
import org.apache.kafka.connect.runtime.WorkerConfig;
2928
import org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster;
@@ -52,7 +51,7 @@ private void buildCluster() {
5251
Map<String, String> workerProps = new HashMap<>();
5352
workerProps.put(WorkerConfig.OFFSET_COMMIT_INTERVAL_MS_CONFIG, String.valueOf(OFFSET_COMMIT_INTERVAL_MS));
5453

55-
String address = NetworkUtils.getAddress("http");
54+
String address = "http://localhost:9999";
5655
LOG.info("Using the following address for the listener configuration: {}", address);
5756
workerProps.put(WorkerConfig.LISTENERS_CONFIG, address);
5857

tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/utils/NetworkUtils.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.net.ConnectException;
2121
import java.net.DatagramSocket;
22-
import java.net.InetAddress;
2322
import java.net.InetSocketAddress;
2423
import java.net.ServerSocket;
2524
import java.net.Socket;
@@ -33,7 +32,6 @@ public final class NetworkUtils {
3332
public static final int DEFAULT_ENDING_PORT = 65535;
3433
public static final int DEFAULT_STARTING_PORT = 49152;
3534
public static int freeStartingPort = DEFAULT_STARTING_PORT;
36-
private static String hostname;
3735
private static final Logger LOG = LoggerFactory.getLogger(NetworkUtils.class);
3836

3937
private NetworkUtils() {
@@ -120,18 +118,7 @@ public enum Protocol {
120118
}
121119

122120
public static String getHostname() {
123-
if (hostname == null) {
124-
try {
125-
hostname = InetAddress.getLocalHost().getCanonicalHostName();
126-
} catch (UnknownHostException e) {
127-
LOG.warn("Will default to 'localhost' because the code could not get the local hostname: {}",
128-
e.getMessage(), e);
129-
130-
hostname = "localhost";
131-
}
132-
}
133-
134-
return hostname;
121+
return "localhost";
135122
}
136123

137124
public static String getAddress(String protocol) {

0 commit comments

Comments
 (0)