|
@@ -19,17 +19,19 @@
|
|
|
|
|
|
package org.elasticsearch.plugins;
|
|
|
|
|
|
+import org.elasticsearch.common.settings.Settings;
|
|
|
+import org.elasticsearch.env.Environment;
|
|
|
+import org.elasticsearch.index.IndexModule;
|
|
|
+import org.elasticsearch.test.ESTestCase;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
-import org.elasticsearch.ElasticsearchException;
|
|
|
-import org.elasticsearch.common.inject.AbstractModule;
|
|
|
-import org.elasticsearch.common.settings.Settings;
|
|
|
-import org.elasticsearch.env.Environment;
|
|
|
-import org.elasticsearch.index.IndexModule;
|
|
|
-import org.elasticsearch.test.ESTestCase;
|
|
|
+import static org.hamcrest.Matchers.containsString;
|
|
|
+import static org.hamcrest.Matchers.hasToString;
|
|
|
|
|
|
public class PluginsServiceTests extends ESTestCase {
|
|
|
public static class AdditionalSettingsPlugin1 extends Plugin {
|
|
@@ -99,4 +101,22 @@ public class PluginsServiceTests extends ESTestCase {
|
|
|
assertEquals(1, scriptPlugins.size());
|
|
|
assertEquals(FilterablePlugin.class, scriptPlugins.get(0).getClass());
|
|
|
}
|
|
|
+
|
|
|
+ public void testHiddenFiles() throws IOException {
|
|
|
+ final Path home = createTempDir();
|
|
|
+ final Settings settings =
|
|
|
+ Settings.builder()
|
|
|
+ .put(Environment.PATH_HOME_SETTING.getKey(), home)
|
|
|
+ .build();
|
|
|
+ final Path hidden = home.resolve("plugins").resolve(".hidden");
|
|
|
+ Files.createDirectories(hidden);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ final IllegalStateException e = expectThrows(
|
|
|
+ IllegalStateException.class,
|
|
|
+ () -> newPluginsService(settings));
|
|
|
+
|
|
|
+ final String expected = "Could not load plugin descriptor for existing plugin [.hidden]";
|
|
|
+ assertThat(e, hasToString(containsString(expected)));
|
|
|
+ }
|
|
|
+
|
|
|
}
|