test: also wait for paused state

Original commit: elastic/x-pack-elasticsearch@8ffec23a21
This commit is contained in:
Martijn van Groningen 2016-11-28 22:43:37 +01:00
parent 2b2307a82b
commit 0cba57194c
1 changed files with 4 additions and 2 deletions

View File

@ -264,13 +264,15 @@ public class PrelertJobIT extends ESRestTestCase {
client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause"); client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause");
assertBusy(() -> { assertBusy(() -> {
try { try {
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/farequote"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/farequote",
Collections.singletonMap("metric", "config,status"));
String responseEntityToString = responseEntityToString(response); String responseEntityToString = responseEntityToString(response);
assertThat(responseEntityToString, containsString("\"ignoreDowntime\":\"ONCE\"")); assertThat(responseEntityToString, containsString("\"ignoreDowntime\":\"ONCE\""));
assertThat(responseEntityToString, containsString("\"status\":\"PAUSED\""));
} catch (Exception e1) { } catch (Exception e1) {
fail(); fail();
} }
}, 2, TimeUnit.SECONDS); });
e = expectThrows(ResponseException.class, e = expectThrows(ResponseException.class,
() -> client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause")); () -> client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause"));