Fall back to HOSTNAME(1) in stream Java test suite
In case the Java way fails (only on new CI).
This commit is contained in:
parent
9725595c00
commit
b140395864
|
|
@ -60,7 +60,6 @@ public class FailureTest {
|
|||
|
||||
@Test
|
||||
void leaderFailureWhenPublisherConnectedToReplica() throws Exception {
|
||||
System.out.println("stream " + stream);
|
||||
Set<String> messages = new HashSet<>();
|
||||
Client client = cf.get(new Client.ClientParameters().port(TestUtils.streamPortNode1()));
|
||||
Map<String, Client.StreamMetadata> metadata = client.metadata(stream);
|
||||
|
|
|
|||
|
|
@ -94,20 +94,23 @@ public class Host {
|
|||
}
|
||||
|
||||
public static String node1name() {
|
||||
try {
|
||||
return System.getProperty(
|
||||
"node1.name", "rabbit-1@" + InetAddress.getLocalHost().getHostName());
|
||||
} catch (UnknownHostException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return System.getProperty("node1.name", "rabbit-1@" + hostname());
|
||||
}
|
||||
|
||||
public static String node2name() {
|
||||
return System.getProperty("node2.name", "rabbit-2@" + hostname());
|
||||
}
|
||||
|
||||
public static String hostname() {
|
||||
try {
|
||||
return System.getProperty(
|
||||
"node2.name", "rabbit-2@" + InetAddress.getLocalHost().getHostName());
|
||||
return InetAddress.getLocalHost().getHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
throw new RuntimeException(e);
|
||||
try {
|
||||
Process process = executeCommand("hostname");
|
||||
return capture(process.getInputStream()).trim();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue