Tests: Add logging and error tracing to watcher bwc tests

Original commit: elastic/x-pack-elasticsearch@4a4b65bcb7
This commit is contained in:
Alexander Reelsen 2017-07-13 11:01:09 +02:00
parent 56cfaf8cb9
commit 32bc0cd5d5
1 changed files with 7 additions and 6 deletions

View File

@ -100,6 +100,8 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
}); });
nodes = buildNodeAndVersions(); nodes = buildNodeAndVersions();
logger.info("Nodes in cluster before test: bwc [{}], new [{}], master [{}]", nodes.getBWCNodes(), nodes.getNewNodes(),
nodes.getMaster());
} }
@Override @Override
@ -159,11 +161,13 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
HttpHost[] newHosts = nodes.getNewNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new); HttpHost[] newHosts = nodes.getNewNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new);
if (newHosts.length > 0) { if (newHosts.length > 0) {
try (RestClient client = buildClient(restClientSettings(), newHosts)) { try (RestClient client = buildClient(restClientSettings(), newHosts)) {
logger.info("checking that upgrade procedure on the new cluster is required"); logger.info("checking that upgrade procedure on the new cluster is required, hosts [{}]", Arrays.asList(newHosts));
Map<String, Object> response = toMap(client().performRequest("GET", "/_xpack/migration/assistance")); Map<String, String> params = Collections.singletonMap("error_trace", "true");
Map<String, Object> response = toMap(client().performRequest("GET", "_xpack/migration/assistance", params));
String action = ObjectPath.evaluate(response, "indices.\\.watches.action_required"); String action = ObjectPath.evaluate(response, "indices.\\.watches.action_required");
logger.info("migration assistance response [{}]", action);
if ("upgrade".equals(action)) { if ("upgrade".equals(action)) {
client.performRequest("POST", "_xpack/migration/upgrade/.watches"); client.performRequest("POST", "_xpack/migration/upgrade/.watches", params);
} }
} }
} }
@ -173,9 +177,6 @@ public class WatchBackwardsCompatibilityIT extends ESRestTestCase {
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);
HttpHost[] bwcHosts = nodes.getBWCNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new); HttpHost[] bwcHosts = nodes.getBWCNodes().stream().map(Node::getPublishAddress).toArray(HttpHost[]::new);
logger.info("# of bwc nodes [{}], number of new nodes [{}], master node [{}]", Arrays.asList(bwcHosts), Arrays.asList(newHosts),
nodes.getMaster().getPublishAddress());
assertTrue("No nodes in cluster, cannot run any tests", newHosts.length > 0 || bwcHosts.length > 0); assertTrue("No nodes in cluster, cannot run any tests", newHosts.length > 0 || bwcHosts.length > 0);
if (newHosts.length > 0) { if (newHosts.length > 0) {