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