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.
This commit is contained in:
Jason Tedor 2017-04-24 11:02:21 -04:00
parent c5b6f52ecc
commit c9a6d66bd5
1 changed files with 8 additions and 1 deletions

View File

@ -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) {