Fix RobinEngineIntegrationTest - missed to explicitly create the index

This commit is contained in:
Simon Willnauer 2013-10-11 11:30:01 +02:00
parent b758b76da4
commit f4cf5a7d4a
1 changed files with 10 additions and 8 deletions

View File

@ -35,21 +35,21 @@ public class RobinEngineIntegrationTest extends AbstractIntegrationTest {
@Test @Test
public void testSetIndexCompoundOnFlush() { public void testSetIndexCompoundOnFlush() {
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0)); client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get();
client().prepareIndex("test", "foo").setSource("field", "foo").get(); client().prepareIndex("test", "foo").setSource("field", "foo").get();
refresh(); refresh();
assertTotalCompoundSegments(2, 2, "test"); assertTotalCompoundSegments(1, 1, "test");
client().admin().indices().prepareUpdateSettings("test") client().admin().indices().prepareUpdateSettings("test")
.setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, false)).get(); .setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, false)).get();
client().prepareIndex("test", "foo").setSource("field", "foo").get(); client().prepareIndex("test", "foo").setSource("field", "foo").get();
refresh(); refresh();
assertTotalCompoundSegments(2, 4, "test"); assertTotalCompoundSegments(1, 2, "test");
client().admin().indices().prepareUpdateSettings("test") client().admin().indices().prepareUpdateSettings("test")
.setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, true)).get(); .setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, true)).get();
client().prepareIndex("test", "foo").setSource("field", "foo").get(); client().prepareIndex("test", "foo").setSource("field", "foo").get();
refresh(); refresh();
assertTotalCompoundSegments(4, 6, "test"); assertTotalCompoundSegments(2, 3, "test");
} }
@ -61,11 +61,13 @@ public class RobinEngineIntegrationTest extends AbstractIntegrationTest {
int total = 0; int total = 0;
for (IndexShardSegments indexShardSegments : values) { for (IndexShardSegments indexShardSegments : values) {
for (ShardSegments s : indexShardSegments) { for (ShardSegments s : indexShardSegments) {
for (Segment segment : s.getSegments()) { for (Segment segment : s) {
if (segment.isCompound()) { if (segment.isSearch() && segment.getNumDocs() > 0) {
compounds++; if (segment.isCompound()) {
compounds++;
}
total++;
} }
total++;
} }
} }
} }