|
9 | 9 | import org.elasticsearch.ResourceNotFoundException;
|
10 | 10 | import org.elasticsearch.action.ActionListener;
|
11 | 11 | import org.elasticsearch.action.support.ActionTestUtils;
|
| 12 | +import org.elasticsearch.action.support.DestructiveOperations; |
12 | 13 | import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
13 | 14 | import org.elasticsearch.cluster.service.ClusterService;
|
| 15 | +import org.elasticsearch.common.settings.Settings; |
14 | 16 | import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
15 | 17 | import org.elasticsearch.common.xcontent.XContentType;
|
16 | 18 | import org.elasticsearch.index.IndexNotFoundException;
|
|
24 | 26 | import java.util.concurrent.CountDownLatch;
|
25 | 27 | import java.util.concurrent.atomic.AtomicReference;
|
26 | 28 |
|
| 29 | +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; |
27 | 30 | import static org.elasticsearch.xpack.enrich.EnrichPolicyTests.randomEnrichPolicy;
|
28 | 31 | import static org.hamcrest.Matchers.equalTo;
|
29 | 32 | import static org.hamcrest.Matchers.nullValue;
|
@@ -116,6 +119,14 @@ public void testDeleteIsNotLocked() throws Exception {
|
116 | 119 | AtomicReference<Exception> error = saveEnrichPolicy(name, policy, clusterService);
|
117 | 120 | assertThat(error.get(), nullValue());
|
118 | 121 |
|
| 122 | + boolean destructiveRequiresName = randomBoolean(); |
| 123 | + if (destructiveRequiresName) { |
| 124 | + Settings settings = Settings.builder() |
| 125 | + .put(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), destructiveRequiresName) |
| 126 | + .build(); |
| 127 | + assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); |
| 128 | + } |
| 129 | + |
119 | 130 | createIndex(EnrichPolicy.getBaseName(name) + "-foo1");
|
120 | 131 | createIndex(EnrichPolicy.getBaseName(name) + "-foo2");
|
121 | 132 |
|
@@ -152,6 +163,11 @@ public void onFailure(final Exception e) {
|
152 | 163 | .get()
|
153 | 164 | );
|
154 | 165 |
|
| 166 | + if (destructiveRequiresName) { |
| 167 | + Settings settings = Settings.builder().putNull(DestructiveOperations.REQUIRES_NAME_SETTING.getKey()).build(); |
| 168 | + assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); |
| 169 | + } |
| 170 | + |
155 | 171 | EnrichPolicyLocks enrichPolicyLocks = getInstanceFromNode(EnrichPolicyLocks.class);
|
156 | 172 | assertFalse(enrichPolicyLocks.captureExecutionState().isAnyPolicyInFlight());
|
157 | 173 |
|
|
0 commit comments