From f72f4807aae3ceb41f25098698907bf545417ac6 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 16 Jun 2015 18:01:39 +0200 Subject: [PATCH] test: increased logging and ensure update requests are acked Original commit: elastic/x-pack-elasticsearch@b4cab02148892e5a7d1c566e0e0b195e914c2d80 --- .../history/HistoryStoreSettingsTests.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/elasticsearch/watcher/history/HistoryStoreSettingsTests.java b/src/test/java/org/elasticsearch/watcher/history/HistoryStoreSettingsTests.java index 80ece1a899a..453023fcf92 100644 --- a/src/test/java/org/elasticsearch/watcher/history/HistoryStoreSettingsTests.java +++ b/src/test/java/org/elasticsearch/watcher/history/HistoryStoreSettingsTests.java @@ -8,17 +8,19 @@ package org.elasticsearch.watcher.history; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.common.settings.ImmutableSettings; 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 { @@ -29,12 +31,14 @@ public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTests { 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(ImmutableSettings.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(ImmutableSettings.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 +58,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(ImmutableSettings.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() {