Merge branch 'master' into upgrade_to_es_20

Conflicts:
	src/test/java/org/elasticsearch/watcher/history/HistoryStoreSettingsTests.java

Original commit: elastic/x-pack-elasticsearch@019d0bcd19
This commit is contained in:
Simon Willnauer 2015-06-16 20:12:05 +02:00
commit c5bf865543
1 changed files with 15 additions and 10 deletions

View File

@ -8,17 +8,19 @@ package org.elasticsearch.watcher.history;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.watcher.history.HistoryStore;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTests;
import org.junit.Test;
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.core.Is.is;
/**
*/
@TestLogging("cluster:DEBUG,action.admin.cluster.settings:DEBUG")
@ElasticsearchIntegrationTest.ClusterScope(scope = TEST, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false, numDataNodes = 1)
public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTests {
@ -28,13 +30,14 @@ public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTests {
assertThat(response.getIndexTemplates().get(0).getSettings().get("index.number_of_shards"), equalTo("1"));
assertThat(response.getIndexTemplates().get(0).getSettings().get("index.number_of_replicas"), nullValue()); // this isn't defined in the template, so we rely on ES's default, which is zero
assertThat(response.getIndexTemplates().get(0).getSettings().get("index.refresh_interval"), nullValue()); // this isn't defined in the template, so we rely on ES's default, which is 1s
client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(Settings.builder()
.put("watcher.history.index.number_of_shards", "2")
.put("watcher.history.index.number_of_replicas", "2")
.put("watcher.history.index.refresh_interval", "5m"))
.get();
assertAcked(
client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(Settings.builder()
.put("watcher.history.index.number_of_shards", "2")
.put("watcher.history.index.number_of_replicas", "2")
.put("watcher.history.index.refresh_interval", "5m"))
.get()
);
// use assertBusy(...) because we update the index template in an async manner
assertBusy(new Runnable() {
@ -54,11 +57,13 @@ public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTests {
assertThat(response.getIndexTemplates().get(0).getSettings().get("index.number_of_shards"), equalTo("1"));
assertThat(response.getIndexTemplates().get(0).getSettings().getAsBoolean("index.mapper.dynamic", null), is(false));
client().admin().cluster().prepareUpdateSettings()
assertAcked(
client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(Settings.builder()
.put("watcher.history.index.number_of_shards", "2")
.put("watcher.history.index.mapper.dynamic", true)) // forbidden setting, should not get updated
.get();
.get()
);
// use assertBusy(...) because we update the index template in an async manner
assertBusy(new Runnable() {