From 14332b5c3d591df10f0c8932efc3c8f9ff70adc0 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 29 Jan 2020 13:50:44 +0100 Subject: [PATCH] Only query for watcher history docs with the expected state, otherwise other history docs can be returned, which may not have the expected state, and this test only checks the first hit. Relates to #30777 --- .../smoketest/SmokeTestWatcherWithSecurityIT.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java index bcc8aa3acdb07..a40b00e826669 100644 --- a/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java +++ b/x-pack/qa/smoke-test-watcher-with-security/src/test/java/org/elasticsearch/smoketest/SmokeTestWatcherWithSecurityIT.java @@ -181,11 +181,7 @@ public void testSearchInputWithInsufficientPrivileges() throws Exception { } // check history, after watch has fired - ObjectPath objectPath = getWatchHistoryEntry(watchId); - assertBusy(() -> { - String state = objectPath.evaluate("hits.hits.0._source.state"); - assertThat(state, is("execution_not_needed")); - }); + ObjectPath objectPath = getWatchHistoryEntry(watchId, "execution_not_needed"); boolean conditionMet = objectPath.evaluate("hits.hits.0._source.result.condition.met"); assertThat(conditionMet, is(false)); }