Tests: Ensure watch index is deleted to execute test correctly
The test requires no watch index or alias to exist, so making sure this is deleted as part of the test. relates elastic/x-pack-elasticsearch#920 Original commit: elastic/x-pack-elasticsearch@c1cc953ce3
This commit is contained in:
parent
7f0fd9e1a3
commit
4b2680dac7
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.xpack.watcher.transport.action.get;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.xpack.watcher.condition.AlwaysCondition;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
|
||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||
|
@ -55,6 +56,10 @@ public class GetWatchTests extends AbstractWatcherIntegrationTestCase {
|
|||
}
|
||||
|
||||
public void testGetNotFoundOnNonExistingIndex() throws Exception {
|
||||
// ensure index/alias is deleted, test infra might have created it automatically
|
||||
try {
|
||||
client().admin().indices().prepareDelete(Watch.INDEX).get();
|
||||
} catch (IndexNotFoundException e) {}
|
||||
Exception e = expectThrows(Exception.class, () -> watcherClient().getWatch(new GetWatchRequest("_name")).get());
|
||||
assertThat(e.getMessage(), containsString("no such index"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue