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@29714b2368
This commit is contained in:
Alexander Reelsen 2017-03-30 14:03:37 +02:00
parent f49dee89cb
commit dfc21c56be
1 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,9 @@ public class BasicSecurityTests extends AbstractWatcherIntegrationTestCase {
} }
public void testWatcherMonitorRole() throws Exception { 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: // stats and get watch apis require at least monitor role:
String token = basicAuthHeaderValue("test", new SecuredString("changeme".toCharArray())); String token = basicAuthHeaderValue("test", new SecuredString("changeme".toCharArray()));