|
45 | 45 | import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE; |
46 | 46 | import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; |
47 | 47 | import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; |
| 48 | +import static org.hamcrest.Matchers.equalTo; |
48 | 49 |
|
49 | 50 | public class FrozenIndexTests extends ESSingleNodeTestCase { |
50 | 51 |
|
@@ -324,4 +325,19 @@ public void testUnfreezeClosedIndex() throws ExecutionException, InterruptedExce |
324 | 325 | assertEquals(IndexMetaData.State.OPEN, |
325 | 326 | client().admin().cluster().prepareState().get().getState().metaData().index("idx").getState()); |
326 | 327 | } |
| 328 | + |
| 329 | + public void testFreezeIndexIncreasesIndexSettingsVersion() throws ExecutionException, InterruptedException { |
| 330 | + final String index = "test"; |
| 331 | + createIndex(index, Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0).build()); |
| 332 | + client().prepareIndex(index, "_doc").setSource("field", "value").execute().actionGet(); |
| 333 | + |
| 334 | + final long settingsVersion = client().admin().cluster().prepareState().get() |
| 335 | + .getState().metaData().index(index).getSettingsVersion(); |
| 336 | + |
| 337 | + XPackClient xPackClient = new XPackClient(client()); |
| 338 | + assertAcked(xPackClient.freeze(new TransportFreezeIndexAction.FreezeRequest(index))); |
| 339 | + assertIndexFrozen(index); |
| 340 | + assertThat(client().admin().cluster().prepareState().get().getState().metaData().index(index).getSettingsVersion(), |
| 341 | + equalTo(settingsVersion + 1)); |
| 342 | + } |
327 | 343 | } |
0 commit comments