|
28 | 28 | import org.elasticsearch.test.rest.ESRestTestCase; |
29 | 29 | import org.elasticsearch.xpack.core.ilm.AllocateAction; |
30 | 30 | import org.elasticsearch.xpack.core.ilm.DeleteAction; |
| 31 | +import org.elasticsearch.xpack.core.ilm.DeleteStep; |
31 | 32 | import org.elasticsearch.xpack.core.ilm.ErrorStep; |
32 | 33 | import org.elasticsearch.xpack.core.ilm.ForceMergeAction; |
33 | 34 | import org.elasticsearch.xpack.core.ilm.FreezeAction; |
@@ -206,6 +207,27 @@ public void testMoveToRolloverStep() throws Exception { |
206 | 207 | assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); |
207 | 208 | } |
208 | 209 |
|
| 210 | + public void testRetryFailedDeleteAction() throws Exception { |
| 211 | + createIndexWithSettings(index, Settings.builder() |
| 212 | + .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) |
| 213 | + .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) |
| 214 | + .put(IndexMetaData.SETTING_READ_ONLY_ALLOW_DELETE, false)); |
| 215 | + |
| 216 | + createNewSingletonPolicy("delete", new DeleteAction()); |
| 217 | + |
| 218 | + Request request = new Request("PUT", index + "/_settings"); |
| 219 | + request.setJsonEntity("{\"index.blocks.read_only\": true, \"index.lifecycle.name\": \"" + policy + "\"}"); |
| 220 | + assertOK(client().performRequest(request)); |
| 221 | + |
| 222 | + assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(DeleteStep.NAME))); |
| 223 | + assertTrue(indexExists(index)); |
| 224 | + |
| 225 | + request.setJsonEntity("{\"index.blocks.read_only\":false}"); |
| 226 | + assertOK(client().performRequest(request)); |
| 227 | + |
| 228 | + assertBusy(() -> assertFalse(indexExists(index))); |
| 229 | + } |
| 230 | + |
209 | 231 | public void testRetryFailedShrinkAction() throws Exception { |
210 | 232 | int numShards = 4; |
211 | 233 | int divisor = randomFrom(2, 4); |
|
0 commit comments