Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: wait for watcher to be started prior to rolling upgrade tests. #52186

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
import org.apache.lucene.util.TimeUnits;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.rest.ESRestTestCase;
Expand All @@ -19,6 +21,10 @@

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.List;
import java.util.Map;

import static org.hamcrest.Matchers.equalTo;


@TimeoutSuite(millis = 5 * TimeUnits.MINUTE) // to account for slow as hell VMs
Expand All @@ -32,6 +38,21 @@ public void waitForTemplates() throws Exception {
XPackRestTestHelper.waitForTemplates(client(), XPackRestTestConstants.ML_POST_V660_TEMPLATES);
}

@Before
public void waitForWatcher() throws Exception {
// Wait for watcher to be in started state in order to avoid errors due
// to manually executing watches prior for watcher to be ready:
assertBusy(() -> {
Response response = client().performRequest(new Request("GET", "_watcher/stats"));
Map<String, Object> responseBody = entityAsMap(response);
List<?> stats = (List<?>) responseBody.get("stats");
for (Object stat : stats) {
Map<?, ?> statAsMap = (Map<?, ?>) stat;
assertThat(statAsMap.get("watcher_state"), equalTo("started"));
}
});
}

@Override
protected boolean preserveIndicesUponCompletion() {
return true;
Expand Down