Adjust .DS_Store test assertions on Windows
Windows handles trying to read a file that does not exist because a component of the path is not a directory differently than other OS handle this situation. This commit adjusts these assertions for Windows.
This commit is contained in:
parent
17d6820a4b
commit
77f87732ef
|
@ -30,6 +30,7 @@ import org.elasticsearch.test.ESTestCase;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileSystemException;
|
import java.nio.file.FileSystemException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -145,7 +146,11 @@ public class PluginsServiceTests extends ESTestCase {
|
||||||
assertThat(e, hasToString(containsString("Could not load plugin descriptor for existing plugin [.DS_Store]")));
|
assertThat(e, hasToString(containsString("Could not load plugin descriptor for existing plugin [.DS_Store]")));
|
||||||
assertNotNull(e.getCause());
|
assertNotNull(e.getCause());
|
||||||
assertThat(e.getCause(), instanceOf(FileSystemException.class));
|
assertThat(e.getCause(), instanceOf(FileSystemException.class));
|
||||||
assertThat(e.getCause(), hasToString(containsString("Not a directory")));
|
if (Constants.WINDOWS) {
|
||||||
|
assertThat(e.getCause(), instanceOf(NoSuchFileException.class));
|
||||||
|
} else {
|
||||||
|
assertThat(e.getCause(), hasToString(containsString("Not a directory")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.FileSystemException;
|
import java.nio.file.FileSystemException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.attribute.PosixFileAttributeView;
|
import java.nio.file.attribute.PosixFileAttributeView;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
|
@ -45,6 +46,7 @@ import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.hamcrest.Matchers.hasToString;
|
import static org.hamcrest.Matchers.hasToString;
|
||||||
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a simple "daemon controller", put it in the right place and check that it runs.
|
* Create a simple "daemon controller", put it in the right place and check that it runs.
|
||||||
|
@ -211,7 +213,11 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
|
||||||
// we do not ignore these files on non-macOS systems
|
// we do not ignore these files on non-macOS systems
|
||||||
final FileSystemException e =
|
final FileSystemException e =
|
||||||
expectThrows(FileSystemException.class, () -> spawner.spawnNativePluginControllers(environment));
|
expectThrows(FileSystemException.class, () -> spawner.spawnNativePluginControllers(environment));
|
||||||
assertThat(e, hasToString(containsString("Not a directory")));
|
if (Constants.WINDOWS) {
|
||||||
|
assertThat(e, instanceOf(NoSuchFileException.class));
|
||||||
|
} else {
|
||||||
|
assertThat(e, hasToString(containsString("Not a directory")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue