From dfc21c56be97f6f5921ff73d86084c93e80d86bc Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Thu, 30 Mar 2017 14:03:37 +0200 Subject: [PATCH] Watcher: Fix BasicSecurityTests.testWatcherMonitorRole The test tried to create a watches index, that could have been created by the test infrastructure already (to check if aliases are supported). relates elastic/x-pack-elasticsearch#837 Original commit: elastic/x-pack-elasticsearch@29714b23686cea245ba36d77cd699461ad0760c6 --- .../xpack/watcher/security/BasicSecurityTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/security/BasicSecurityTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/security/BasicSecurityTests.java index 8a9f68fc361..b42e5b96314 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/security/BasicSecurityTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/security/BasicSecurityTests.java @@ -58,7 +58,9 @@ public class BasicSecurityTests extends AbstractWatcherIntegrationTestCase { } public void testWatcherMonitorRole() throws Exception { - assertAcked(client().admin().indices().prepareCreate(Watch.INDEX)); + if (client().admin().indices().prepareExists(Watch.INDEX).get().isExists() == false) { + assertAcked(client().admin().indices().prepareCreate(Watch.INDEX)); + } // stats and get watch apis require at least monitor role: String token = basicAuthHeaderValue("test", new SecuredString("changeme".toCharArray()));