|
| 1 | +/* |
| 2 | + * Licensed to Elasticsearch under one or more contributor |
| 3 | + * license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright |
| 5 | + * ownership. Elasticsearch licenses this file to you under |
| 6 | + * the Apache License, Version 2.0 (the "License"); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package org.elasticsearch.cluster.metadata; |
| 21 | + |
| 22 | +import org.elasticsearch.Version; |
| 23 | +import org.elasticsearch.common.settings.Settings; |
| 24 | +import org.elasticsearch.test.ESSingleNodeTestCase; |
| 25 | + |
| 26 | +import static org.hamcrest.Matchers.equalTo; |
| 27 | + |
| 28 | +public class UpgradeIndexSettingsIT extends ESSingleNodeTestCase { |
| 29 | + |
| 30 | + @Override |
| 31 | + protected boolean forbidPrivateIndexSettings() { |
| 32 | + return false; |
| 33 | + } |
| 34 | + |
| 35 | + public void testSettingsVersion() { |
| 36 | + createIndex( |
| 37 | + "test", |
| 38 | + Settings |
| 39 | + .builder() |
| 40 | + .put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), Version.CURRENT.minimumIndexCompatibilityVersion()) |
| 41 | + .build()); |
| 42 | + final long settingsVersion = |
| 43 | + client().admin().cluster().prepareState().get().getState().metaData().index("test").getSettingsVersion(); |
| 44 | + client().admin().indices().prepareUpgrade("test").get(); |
| 45 | + assertThat( |
| 46 | + client().admin().cluster().prepareState().get().getState().metaData().index("test").getSettingsVersion(), |
| 47 | + equalTo(1 + settingsVersion)); |
| 48 | + } |
| 49 | + |
| 50 | +} |
0 commit comments