Skip to content

Commit 8214462

Browse files
committed
Enable not wiping cluster settings after REST test (#33575)
In some cases we want to skip wiping cluster settings after a REST test. For example, one use-case would be in the full cluster restart tests where want to test cluster settings before and after a full cluster restart. If we wipe the cluster settings before the restart, then it would not be possible to assert on them after the restart.
1 parent 27d848f commit 8214462

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ protected boolean preserveTemplatesUponCompletion() {
236236
return false;
237237
}
238238

239+
/**
240+
* Controls whether or not to preserve cluster settings upon completion of the test. The default implementation is to remove all cluster
241+
* settings.
242+
*
243+
* @return true if cluster settings should be preserved and otherwise false
244+
*/
245+
protected boolean preserveClusterSettings() {
246+
return false;
247+
}
248+
239249
/**
240250
* Returns whether to preserve the repositories on completion of this test.
241251
* Defaults to not preserving repos. See also
@@ -295,7 +305,11 @@ private void wipeCluster() throws IOException {
295305
}
296306

297307
wipeSnapshots();
298-
wipeClusterSettings();
308+
309+
// wipe cluster settings
310+
if (preserveClusterSettings() == false) {
311+
wipeClusterSettings();
312+
}
299313
}
300314

301315
/**

0 commit comments

Comments
 (0)