Improve rolling upgrade test setup assertions (#58313)

wrap test setup and add proper assert messages

relates #58282
This commit is contained in:
Hendrik Muhs 2020-06-24 16:52:54 +02:00
parent 69f73d948b
commit c1bbfeddc9
1 changed files with 19 additions and 11 deletions

View File

@ -36,13 +36,18 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCa
*/ */
@Before @Before
public void waitForTemplates() throws Exception { public void waitForTemplates() throws Exception {
try {
XPackRestTestHelper.waitForTemplates(client(), XPackRestTestConstants.ML_POST_V660_TEMPLATES); XPackRestTestHelper.waitForTemplates(client(), XPackRestTestConstants.ML_POST_V660_TEMPLATES);
} catch (AssertionError e) {
throw new AssertionError("Failure in test setup: Failed to initialize ML index templates", e);
}
} }
@Before @Before
public void waitForWatcher() throws Exception { public void waitForWatcher() throws Exception {
// Wait for watcher to be in started state in order to avoid errors due // Wait for watcher to be in started state in order to avoid errors due
// to manually executing watches prior for watcher to be ready: // to manually executing watches prior for watcher to be ready:
try {
assertBusy(() -> { assertBusy(() -> {
Response response = client().performRequest(new Request("GET", "_watcher/stats")); Response response = client().performRequest(new Request("GET", "_watcher/stats"));
Map<String, Object> responseBody = entityAsMap(response); Map<String, Object> responseBody = entityAsMap(response);
@ -53,6 +58,9 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCa
assertThat(statAsMap.get("watcher_state"), equalTo("started")); assertThat(statAsMap.get("watcher_state"), equalTo("started"));
} }
}, 1, TimeUnit.MINUTES); }, 1, TimeUnit.MINUTES);
} catch (AssertionError e) {
throw new AssertionError("Failure in test setup: Failed to initialize at least 3 watcher nodes", e);
}
} }
@Override @Override