浏览代码

Verify watch_count before a test starts and not after a test.

This check was added as part of: 0f2d26bdcae370a1225e58e06585907c5c4082eb

Checking this before the test starts makes more sense, because
the watches index has then also be removed.

Relates to #53177
Martijn van Groningen 5 年之前
父节点
当前提交
86cb6800b6

+ 2 - 2
x-pack/plugin/watcher/qa/rest/src/test/java/org/elasticsearch/xpack/watcher/WatcherYamlSuiteTestCase.java

@@ -53,6 +53,8 @@ public abstract class WatcherYamlSuiteTestCase extends ESClientYamlSuiteTestCase
                 case "starting":
                     throw new AssertionError("waiting until starting state reached started state");
                 case "started":
+                    int watcherCount = (int) response.evaluate("stats.0.watch_count");
+                    assertThat(watcherCount, equalTo(0));
                     // all good here, we are done
                     break;
                 default:
@@ -70,8 +72,6 @@ public abstract class WatcherYamlSuiteTestCase extends ESClientYamlSuiteTestCase
             String state = (String) response.evaluate("stats.0.watcher_state");
             switch (state) {
                 case "stopped":
-                    int watcherCount = (int) response.evaluate("stats.0.watch_count");
-                    assertThat(watcherCount, equalTo(0));
                     // all good here, we are done
                     break;
                 case "stopping":