mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
Tests: Increase logging in watcher upgrade tests to debug test failures
Original commit: elastic/x-pack-elasticsearch@380a8541dc
This commit is contained in:
parent
b530da945d
commit
8f6874abf9
@ -6,13 +6,13 @@
|
|||||||
package org.elasticsearch.upgrades;
|
package org.elasticsearch.upgrades;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
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.HttpHost;
|
||||||
import org.elasticsearch.client.http.entity.ContentType;
|
import org.elasticsearch.client.http.entity.ContentType;
|
||||||
import org.elasticsearch.client.http.entity.StringEntity;
|
import org.elasticsearch.client.http.entity.StringEntity;
|
||||||
import org.elasticsearch.client.http.util.EntityUtils;
|
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.CheckedConsumer;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.io.Streams;
|
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.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
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.ESRestTestCase;
|
||||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||||
import org.elasticsearch.xpack.watcher.condition.AlwaysCondition;
|
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.greaterThanOrEqualTo;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
|
||||||
|
@TestLogging("org.elasticsearch.client:TRACE")
|
||||||
public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
|
public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
|
||||||
|
|
||||||
private Nodes nodes;
|
private Nodes nodes;
|
||||||
@ -135,8 +137,7 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testWatcherRestart() throws Exception {
|
public void testWatcherRestart() throws Exception {
|
||||||
// TODO we should be able to run this against any node, once the bwc serialization issues are fixed
|
executeAgainstRandomNode(client -> {
|
||||||
executeAgainstMasterNode(client -> {
|
|
||||||
assertOK(client.performRequest("POST", "/_xpack/watcher/_stop"));
|
assertOK(client.performRequest("POST", "/_xpack/watcher/_stop"));
|
||||||
assertBusy(() -> {
|
assertBusy(() -> {
|
||||||
try (InputStream is = client.performRequest("GET", "_xpack/watcher/stats").getEntity().getContent()) {
|
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
|
// 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
|
// that has not configured the `index.format: 6`, resulting in watcher not starting
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
@ -160,8 +160,7 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
|
|||||||
|
|
||||||
executeUpgradeIfNeeded();
|
executeUpgradeIfNeeded();
|
||||||
|
|
||||||
// TODO we should be able to run this against any node, once the bwc serialization issues are fixed
|
executeAgainstRandomNode(client -> {
|
||||||
executeAgainstMasterNode(client -> {
|
|
||||||
assertOK(client.performRequest("POST", "/_xpack/watcher/_start"));
|
assertOK(client.performRequest("POST", "/_xpack/watcher/_start"));
|
||||||
assertBusy(() -> {
|
assertBusy(() -> {
|
||||||
try (InputStream is = client.performRequest("GET", "_xpack/watcher/stats").getEntity().getContent()) {
|
try (InputStream is = client.performRequest("GET", "_xpack/watcher/stats").getEntity().getContent()) {
|
||||||
@ -233,12 +232,6 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeAgainstMasterNode(CheckedConsumer<RestClient, Exception> consumer) throws Exception {
|
|
||||||
try (RestClient client = buildClient(restClientSettings(), new HttpHost[] { this.nodes.getMaster().publishAddress })) {
|
|
||||||
consumer.accept(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void executeAgainstAllNodes(CheckedConsumer<RestClient, IOException> consumer)
|
private void executeAgainstAllNodes(CheckedConsumer<RestClient, IOException> consumer)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
HttpHost[] newHosts = nodes.getNewNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new);
|
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());
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Nodes{" +
|
return "Nodes{" +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user