[TEST] Use NoMergePolicy in EngineTest#testVerboseSegments

These tests rely on that there are no merges but since MP is now
random this can break the test.
This commit is contained in:
Simon Willnauer 2015-06-14 12:20:28 +02:00
parent 0ac09fde95
commit 02e540384d
2 changed files with 26 additions and 19 deletions

View File

@ -384,6 +384,9 @@ public class InternalEngineTests extends ElasticsearchTestCase {
}
public void testVerboseSegments() throws Exception {
IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build());
try (Store store = createStore();
Engine engine = createEngine(indexSettingsService, store, createTempDir(), new MergeSchedulerConfig(defaultSettings), NoMergePolicy.INSTANCE)) {
List<Segment> segments = engine.segments(true);
assertThat(segments.isEmpty(), equalTo(true));
@ -407,6 +410,7 @@ public class InternalEngineTests extends ElasticsearchTestCase {
assertThat(segments.get(0).ramTree, notNullValue());
assertThat(segments.get(1).ramTree, notNullValue());
assertThat(segments.get(2).ramTree, notNullValue());
}
}

View File

@ -440,6 +440,9 @@ public class ShadowEngineTests extends ElasticsearchTestCase {
@Test
public void testVerboseSegments() throws Exception {
IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build());
primaryEngine.close(); // recreate without merging
primaryEngine = createInternalEngine(indexSettingsService, store, createTempDir(), NoMergePolicy.INSTANCE);
List<Segment> segments = primaryEngine.segments(true);
assertThat(segments.isEmpty(), equalTo(true));