warmer test to use 0 replicas

they are meaningless in the context of the test, should stabilize it
This commit is contained in:
Shay Banon 2013-07-30 10:07:49 +02:00
parent 4724725681
commit 07569b4808
1 changed files with 7 additions and 9 deletions

View File

@ -31,10 +31,8 @@ import org.elasticsearch.test.integration.AbstractSharedClusterTest;
import org.hamcrest.Matchers;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
/**
*/
@ -182,7 +180,7 @@ public class SimpleIndicesWarmerTests extends AbstractSharedClusterTest {
public void ensureThatIndexWarmersCanBeChangedOnRuntime() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
client().admin().indices().prepareCreate("test")
.setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1))
.setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1, "index.number_of_replicas", 0))
.execute().actionGet();
client().admin().cluster().prepareHealth("test").setWaitForGreenStatus().execute().actionGet();
@ -191,16 +189,16 @@ public class SimpleIndicesWarmerTests extends AbstractSharedClusterTest {
.setSearchRequest(client().prepareSearch("test").setTypes("test").setQuery(QueryBuilders.matchAllQuery()))
.execute().actionGet();
client().prepareIndex("test", "test", "1").setSource("{ \"foo\" : \"bar\"}").setRefresh(true).execute().actionGet();
client().prepareIndex("test", "test", "1").setSource("foo", "bar").setRefresh(true).execute().actionGet();
client().admin().indices().prepareUpdateSettings("test").setSettings("{ \"index.warmer.enabled\": false}").execute().actionGet();
client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put("index.warmer.enabled", false)).execute().actionGet();
long warmerRunsAfterDisabling = getWarmerRuns();
assertThat(warmerRunsAfterDisabling, is(greaterThan(1L)));
assertThat(getWarmerRuns(), greaterThanOrEqualTo(1L));
client().prepareIndex("test", "test", "2").setSource("{ \"foo2\" : \"bar2\"}").setRefresh(true).execute().actionGet();
client().prepareIndex("test", "test", "2").setSource("foo2", "bar2").setRefresh(true).execute().actionGet();
assertThat(warmerRunsAfterDisabling, is(getWarmerRuns()));
assertThat(getWarmerRuns(), equalTo(warmerRunsAfterDisabling));
}
private long getWarmerRuns() {