Skip to content

Commit 56f1261

Browse files
nik9000kcm
authored andcommitted
Test: Fix running with external cluster
Back in #32983 I broke running the integ-test-zip tests against an external cluster by adding a test that reads the contents of the log file. This fixes running against an external cluster by explicitly skipping that test if running against an external cluster.
1 parent d25ff24 commit 56f1261

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

distribution/archives/integ-test-zip/build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
*/
1919

2020
integTestRunner {
21-
systemProperty 'tests.logfile',
22-
"${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }.log"
21+
/*
22+
* There are two unique things going on here:
23+
* 1. These tests can be run against an external cluster with
24+
* -Dtests.rest.cluster=whatever and -Dtest.cluster=whatever
25+
* 2. *One* of these tests is incompatible with that and should be skipped
26+
* when running against an external cluster.
27+
*/
28+
if (System.getProperty("tests.rest.cluster") == null) {
29+
systemProperty 'tests.logfile',
30+
"${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }.log"
31+
} else {
32+
systemProperty 'tests.logfile', '--external--'
33+
}
2334
}

distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/NodeNameInLogsIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ protected Matcher<String> nodeNameMatcher() {
4040

4141
@Override
4242
protected BufferedReader openReader(Path logFile) {
43+
assumeFalse("Skipping test because it is being run against an external cluster.",
44+
logFile.getFileName().toString().equals("--external--"));
4345
return AccessController.doPrivileged((PrivilegedAction<BufferedReader>) () -> {
4446
try {
4547
return Files.newBufferedReader(logFile, StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)