[TEST] Use deprecated form of rollup endpoint in mixed cluster (#36000)
When wiping rollup jobs, if we are in a mixed cluster with < v7.0 nodes we need to fall back to the deprecated endpoint because we may talk to a 6.x node.
This commit is contained in:
parent
9fa9e1419f
commit
85cdf4f913
|
@ -474,7 +474,9 @@ public abstract class ESRestTestCase extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wipeRollupJobs() throws IOException, InterruptedException {
|
private void wipeRollupJobs() throws IOException, InterruptedException {
|
||||||
Response response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
|
String rollupPrefix = nodeVersions.stream().anyMatch(node -> node.before(Version.V_7_0_0)) ? "/_xpack/rollup" : "/_rollup";
|
||||||
|
|
||||||
|
Response response = adminClient().performRequest(new Request("GET", rollupPrefix + "/job/_all"));
|
||||||
Map<String, Object> jobs = entityAsMap(response);
|
Map<String, Object> jobs = entityAsMap(response);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Map<String, Object>> jobConfigs =
|
List<Map<String, Object>> jobConfigs =
|
||||||
|
@ -487,7 +489,7 @@ public abstract class ESRestTestCase extends ESTestCase {
|
||||||
for (Map<String, Object> jobConfig : jobConfigs) {
|
for (Map<String, Object> jobConfig : jobConfigs) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
String jobId = (String) ((Map<String, Object>) jobConfig.get("config")).get("id");
|
String jobId = (String) ((Map<String, Object>) jobConfig.get("config")).get("id");
|
||||||
Request request = new Request("POST", "/_rollup/job/" + jobId + "/_stop");
|
Request request = new Request("POST", rollupPrefix + "/job/" + jobId + "/_stop");
|
||||||
request.addParameter("ignore", "404");
|
request.addParameter("ignore", "404");
|
||||||
request.addParameter("wait_for_completion", "true");
|
request.addParameter("wait_for_completion", "true");
|
||||||
request.addParameter("timeout", "10s");
|
request.addParameter("timeout", "10s");
|
||||||
|
@ -498,7 +500,7 @@ public abstract class ESRestTestCase extends ESTestCase {
|
||||||
for (Map<String, Object> jobConfig : jobConfigs) {
|
for (Map<String, Object> jobConfig : jobConfigs) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
String jobId = (String) ((Map<String, Object>) jobConfig.get("config")).get("id");
|
String jobId = (String) ((Map<String, Object>) jobConfig.get("config")).get("id");
|
||||||
Request request = new Request("DELETE", "/_rollup/job/" + jobId);
|
Request request = new Request("DELETE", rollupPrefix + "/job/" + jobId);
|
||||||
request.addParameter("ignore", "404"); // Ignore 404s because they imply someone was racing us to delete this
|
request.addParameter("ignore", "404"); // Ignore 404s because they imply someone was racing us to delete this
|
||||||
logger.debug("deleting rollup job [{}]", jobId);
|
logger.debug("deleting rollup job [{}]", jobId);
|
||||||
adminClient().performRequest(request);
|
adminClient().performRequest(request);
|
||||||
|
|
Loading…
Reference in New Issue