From 8c7840481434286afee977e5e2fdb90579be9796 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 29 Jan 2020 13:51:42 +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 | 4 +--- 1 file changed, 1 insertion(+), 3 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 341ae75fa5a..fd09ec927d5 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,9 +181,7 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase { } // check history, after watch has fired - ObjectPath objectPath = getWatchHistoryEntry(watchId); - 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)); }