Prevent the rolling upgrades rest tests from cleaning up indices
after finishing if a the tests.rest.preserve_indices system property is set
This commit is contained in:
parent
513ed58d17
commit
3f79874042
|
@ -31,6 +31,7 @@ task oldClusterTest(type: RestIntegTestTask) {
|
|||
clusterName = 'rolling-upgrade'
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'old_cluster'
|
||||
systemProperty 'tests.rest.preserve_indices', 'true'
|
||||
}
|
||||
|
||||
task mixedClusterTest(type: RestIntegTestTask) {
|
||||
|
@ -42,7 +43,7 @@ task mixedClusterTest(type: RestIntegTestTask) {
|
|||
dataDir = "${-> oldClusterTest.nodes[1].dataDir}"
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
||||
|
||||
systemProperty 'tests.rest.preserve_indices', 'true'
|
||||
}
|
||||
|
||||
task upgradedClusterTest(type: RestIntegTestTask) {
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
---
|
||||
"Index data and search on the mixed cluster":
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_status: green
|
||||
|
||||
- do:
|
||||
indices.get_settings:
|
||||
index: test_index
|
||||
|
||||
- match: { test_index.settings.index.number_of_replicas: "0" }
|
||||
|
||||
- do:
|
||||
search:
|
||||
index: test_index
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
---
|
||||
"Index data and search on the old cluster":
|
||||
- do:
|
||||
indices.create:
|
||||
index: test_index
|
||||
body:
|
||||
settings:
|
||||
index:
|
||||
number_of_replicas: 0
|
||||
|
||||
- do:
|
||||
bulk:
|
||||
refresh: true
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
---
|
||||
"Index data and search on the upgraded cluster":
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_status: green
|
||||
|
||||
- do:
|
||||
search:
|
||||
index: test_index
|
||||
|
|
|
@ -138,13 +138,16 @@ public class ESRestTestCase extends ESTestCase {
|
|||
}
|
||||
|
||||
private void wipeCluster() throws IOException {
|
||||
// wipe indices
|
||||
try {
|
||||
adminClient().performRequest("DELETE", "*");
|
||||
} catch (ResponseException e) {
|
||||
// 404 here just means we had no indexes
|
||||
if (e.getResponse().getStatusLine().getStatusCode() != 404) {
|
||||
throw e;
|
||||
final boolean preserveIndices = Boolean.parseBoolean(System.getProperty("tests.rest.preserve_indices"));
|
||||
if (preserveIndices == false) {
|
||||
// wipe indices
|
||||
try {
|
||||
adminClient().performRequest("DELETE", "*");
|
||||
} catch (ResponseException e) {
|
||||
// 404 here just means we had no indexes
|
||||
if (e.getResponse().getStatusLine().getStatusCode() != 404) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue