From 79c735a04d6da7a087b83e6678fcac85d684e57c Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 15 Oct 2018 15:10:43 -0400 Subject: [PATCH] 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. --- distribution/archives/integ-test-zip/build.gradle | 15 +++++++++++++-- .../elasticsearch/test/rest/NodeNameInLogsIT.java | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/distribution/archives/integ-test-zip/build.gradle b/distribution/archives/integ-test-zip/build.gradle index 4c2ac7d1cf4de..30fa4d3c03805 100644 --- a/distribution/archives/integ-test-zip/build.gradle +++ b/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--' + } } diff --git a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/NodeNameInLogsIT.java b/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/NodeNameInLogsIT.java index 3f6fbad2fbdff..a854e6e66462a 100644 --- a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/NodeNameInLogsIT.java +++ b/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/NodeNameInLogsIT.java @@ -40,6 +40,8 @@ protected Matcher nodeNameMatcher() { @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) () -> { try { return Files.newBufferedReader(logFile, StandardCharsets.UTF_8);