diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/WatchBackwardsCompatibilityIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/WatchBackwardsCompatibilityIT.java index ea314ef02c9..5c2f9e2ac67 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/WatchBackwardsCompatibilityIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/WatchBackwardsCompatibilityIT.java @@ -6,13 +6,13 @@ package org.elasticsearch.upgrades; import com.google.common.base.Charsets; +import org.elasticsearch.Version; +import org.elasticsearch.client.Response; +import org.elasticsearch.client.RestClient; import org.elasticsearch.client.http.HttpHost; import org.elasticsearch.client.http.entity.ContentType; import org.elasticsearch.client.http.entity.StringEntity; import org.elasticsearch.client.http.util.EntityUtils; -import org.elasticsearch.Version; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; import org.elasticsearch.common.CheckedConsumer; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.Streams; @@ -21,6 +21,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; +import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.test.rest.yaml.ObjectPath; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; @@ -52,6 +53,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.not; +@TestLogging("org.elasticsearch.client:TRACE") public class WatchBackwardsCompatibilityIT extends ESRestTestCase { private Nodes nodes; @@ -135,8 +137,7 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase { } public void testWatcherRestart() throws Exception { - // TODO we should be able to run this against any node, once the bwc serialization issues are fixed - executeAgainstMasterNode(client -> { + executeAgainstRandomNode(client -> { assertOK(client.performRequest("POST", "/_xpack/watcher/_stop")); assertBusy(() -> { try (InputStream is = client.performRequest("GET", "_xpack/watcher/stats").getEntity().getContent()) { @@ -150,7 +151,6 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase { }); }); - // TODO remove this again, as the upgrade API should take care of this // currently the triggered watches index is not checked by the upgrade API, resulting in an existing index // that has not configured the `index.format: 6`, resulting in watcher not starting Map params = new HashMap<>(); @@ -160,8 +160,7 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase { executeUpgradeIfNeeded(); - // TODO we should be able to run this against any node, once the bwc serialization issues are fixed - executeAgainstMasterNode(client -> { + executeAgainstRandomNode(client -> { assertOK(client.performRequest("POST", "/_xpack/watcher/_start")); assertBusy(() -> { try (InputStream is = client.performRequest("GET", "_xpack/watcher/stats").getEntity().getContent()) { @@ -233,12 +232,6 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase { } } - private void executeAgainstMasterNode(CheckedConsumer consumer) throws Exception { - try (RestClient client = buildClient(restClientSettings(), new HttpHost[] { this.nodes.getMaster().publishAddress })) { - consumer.accept(client); - } - } - private void executeAgainstAllNodes(CheckedConsumer consumer) throws IOException { HttpHost[] newHosts = nodes.getNewNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new); @@ -318,14 +311,6 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase { return Version.fromId(values().stream().map(node -> node.getVersion().id).min(Integer::compareTo).get()); } - public Node getSafe(String id) { - Node node = get(id); - if (node == null) { - throw new IllegalArgumentException("node with id [" + id + "] not found"); - } - return node; - } - @Override public String toString() { return "Nodes{" +