Browse Source

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.
Nik Everett 7 years ago
parent
commit
79c735a04d

+ 13 - 2
distribution/archives/integ-test-zip/build.gradle

@@ -18,6 +18,17 @@
  */
 
 integTestRunner {
-  systemProperty 'tests.logfile',
-    "${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }.log"
+  /*
+   * There are two unique things going on here:
+   * 1. These tests can be run against an external cluster with
+   *    -Dtests.rest.cluster=whatever and -Dtest.cluster=whatever
+   * 2. *One* of these tests is incompatible with that and should be skipped
+   *    when running against an external cluster.
+   */
+  if (System.getProperty("tests.rest.cluster") == null) {
+    systemProperty 'tests.logfile',
+      "${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }.log"
+  } else {
+    systemProperty 'tests.logfile', '--external--'
+  }
 }

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

@@ -40,6 +40,8 @@ public class NodeNameInLogsIT extends NodeNameInLogsIntegTestCase {
 
     @Override
     protected BufferedReader openReader(Path logFile) {
+        assumeFalse("Skipping test because it is being run against an external cluster.",
+                logFile.getFileName().toString().equals("--external--"));
         return AccessController.doPrivileged((PrivilegedAction<BufferedReader>) () -> {
             try {
                 return Files.newBufferedReader(logFile, StandardCharsets.UTF_8);