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:
Ali Beyad 2016-09-14 23:34:19 -04:00
parent 513ed58d17
commit 3f79874042
5 changed files with 34 additions and 8 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,9 @@
---
"Index data and search on the upgraded cluster":
- do:
cluster.health:
wait_for_status: green
- do:
search:
index: test_index

View File

@ -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;
}
}
}