From c9a6d66bd5f67e9fc65204529234a9f3ee3b2932 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 24 Apr 2017 11:02:21 -0400 Subject: [PATCH] Only test hard linking to directory on macOS This skips trying to create a hard link to a directory in the evil node tests on non-macOS operating systems. --- .../test/java/org/elasticsearch/node/EvilNodeTests.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/node/EvilNodeTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/node/EvilNodeTests.java index ac29902627d..341d1227926 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/node/EvilNodeTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/node/EvilNodeTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.node; import org.apache.logging.log4j.Logger; +import org.apache.lucene.util.Constants; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; @@ -38,7 +39,13 @@ public class EvilNodeTests extends ESTestCase { public void testDefaultPathDataIncludedInPathData() throws IOException { final Path zero = createTempDir().toAbsolutePath(); final Path one = createTempDir().toAbsolutePath(); - final int random = randomIntBetween(0, 2); + // creating hard links to directories is okay on macOS so we exercise it here + final int random; + if (Constants.MAC_OS_X) { + random = randomFrom(0, 1, 2); + } else { + random = randomFrom(0, 1); + } final Path defaultPathData; final Path choice = randomFrom(zero, one); switch (random) {