|
@@ -104,6 +104,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
|
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
|
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
|
|
import static org.elasticsearch.index.IndexSettings.INDEX_REFRESH_INTERVAL_SETTING;
|
|
|
+import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAliasesExist;
|
|
@@ -135,15 +136,29 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|
|
MockRepository.Plugin.class);
|
|
|
}
|
|
|
|
|
|
+ private Settings randomRepoSettings() {
|
|
|
+ Settings.Builder repoSettings = Settings.builder();
|
|
|
+ repoSettings.put("location", randomRepoPath());
|
|
|
+ if (randomBoolean()) {
|
|
|
+ repoSettings.put("compress", randomBoolean());
|
|
|
+ }
|
|
|
+ if (randomBoolean()) {
|
|
|
+ repoSettings.put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES);
|
|
|
+ } else {
|
|
|
+ if (randomBoolean()) {
|
|
|
+ repoSettings.put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES);
|
|
|
+ } else {
|
|
|
+ repoSettings.put("chunk_size", (String) null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return repoSettings.build();
|
|
|
+ }
|
|
|
+
|
|
|
public void testBasicWorkFlow() throws Exception {
|
|
|
Client client = client();
|
|
|
|
|
|
logger.info("--> creating repository");
|
|
|
- assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
|
|
- .setType("fs").setSettings(Settings.builder()
|
|
|
- .put("location", randomRepoPath())
|
|
|
- .put("compress", randomBoolean())
|
|
|
- .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES)));
|
|
|
+ assertAcked(client.admin().cluster().preparePutRepository("test-repo").setType("fs").setSettings(randomRepoSettings()));
|
|
|
|
|
|
createIndex("test-idx-1", "test-idx-2", "test-idx-3");
|
|
|
ensureGreen();
|
|
@@ -308,11 +323,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|
|
Client client = client();
|
|
|
|
|
|
logger.info("--> creating repository");
|
|
|
- assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
|
|
- .setType("fs").setSettings(Settings.builder()
|
|
|
- .put("location", randomRepoPath())
|
|
|
- .put("compress", randomBoolean())
|
|
|
- .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES)));
|
|
|
+ assertAcked(client.admin().cluster().preparePutRepository("test-repo").setType("fs").setSettings(randomRepoSettings()));
|
|
|
|
|
|
createIndex("test");
|
|
|
String originalIndexUUID = client().admin().indices().prepareGetSettings("test").get().getSetting("test", IndexMetaData.SETTING_INDEX_UUID);
|
|
@@ -356,11 +367,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|
|
Client client = client();
|
|
|
|
|
|
logger.info("--> creating repository");
|
|
|
- assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
|
|
- .setType("fs").setSettings(Settings.builder()
|
|
|
- .put("location", randomRepoPath())
|
|
|
- .put("compress", randomBoolean())
|
|
|
- .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES)));
|
|
|
+ assertAcked(client.admin().cluster().preparePutRepository("test-repo").setType("fs").setSettings(randomRepoSettings()));
|
|
|
|
|
|
logger.info("--> create index with foo type");
|
|
|
assertAcked(prepareCreate("test-idx", 2, Settings.builder()
|