From 0cba57194cb06d111e4667e3d21d34ad3b77d3a8 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 28 Nov 2016 22:43:37 +0100 Subject: [PATCH] test: also wait for paused state Original commit: elastic/x-pack-elasticsearch@8ffec23a21939afad45d981d04842a7ed8fa6b53 --- .../xpack/prelert/integration/PrelertJobIT.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/PrelertJobIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/PrelertJobIT.java index 058586f2170..3cec53e8cce 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/PrelertJobIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/PrelertJobIT.java @@ -264,13 +264,15 @@ public class PrelertJobIT extends ESRestTestCase { client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause"); assertBusy(() -> { 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); assertThat(responseEntityToString, containsString("\"ignoreDowntime\":\"ONCE\"")); + assertThat(responseEntityToString, containsString("\"status\":\"PAUSED\"")); } catch (Exception e1) { fail(); } - }, 2, TimeUnit.SECONDS); + }); e = expectThrows(ResponseException.class, () -> client().performRequest("post", PrelertPlugin.BASE_PATH + "jobs/farequote/_pause"));