Additional assertions for SLM restart tests (#48428)

Adds the ability to conditionally wipe SLM policies
and ensures that you can read what you wrote across
restarts.
This commit is contained in:
Jake Landis 2019-10-30 17:12:16 -05:00 committed by Yannick Welsch
parent f6686345c9
commit 1197ebb9e9
2 changed files with 19 additions and 2 deletions

View File

@ -473,13 +473,22 @@ public abstract class ESRestTestCase extends ESTestCase {
/** /**
* Returns whether to preserve ILM Policies of this test. Defaults to not * Returns whether to preserve ILM Policies of this test. Defaults to not
* preserviing them. Only runs at all if xpack is installed on the cluster * preserving them. Only runs at all if xpack is installed on the cluster
* being tested. * being tested.
*/ */
protected boolean preserveILMPoliciesUponCompletion() { protected boolean preserveILMPoliciesUponCompletion() {
return false; return false;
} }
/**
* Returns whether to preserve SLM Policies of this test. Defaults to not
* preserving them. Only runs at all if xpack is installed on the cluster
* being tested.
*/
protected boolean preserveSLMPoliciesUponCompletion() {
return false;
}
/** /**
* A set of ILM policies that should be preserved between runs. * A set of ILM policies that should be preserved between runs.
*/ */
@ -514,7 +523,10 @@ public abstract class ESRestTestCase extends ESTestCase {
// Clean up SLM policies before trying to wipe snapshots so that no new ones get started by SLM after wiping // Clean up SLM policies before trying to wipe snapshots so that no new ones get started by SLM after wiping
if (nodeVersions.first().onOrAfter(Version.V_7_4_0)) { // SLM was introduced in version 7.4 if (nodeVersions.first().onOrAfter(Version.V_7_4_0)) { // SLM was introduced in version 7.4
deleteAllSLMPolicies(); if (preserveSLMPoliciesUponCompletion() == false) {
// Clean up SLM policies before trying to wipe snapshots so that no new ones get started by SLM after wiping
deleteAllSLMPolicies();
}
} }
SetOnce<Map<String, List<Map<?,?>>>> inProgressSnapshots = new SetOnce<>(); SetOnce<Map<String, List<Map<?,?>>>> inProgressSnapshots = new SetOnce<>();

View File

@ -109,4 +109,9 @@ public abstract class AbstractFullClusterRestartTestCase extends ESRestTestCase
protected boolean preserveILMPoliciesUponCompletion() { protected boolean preserveILMPoliciesUponCompletion() {
return true; return true;
} }
@Override
protected boolean preserveSLMPoliciesUponCompletion() {
return true;
}
} }