From 39eec660ca79b62947321390e07e83d84be419e5 Mon Sep 17 00:00:00 2001 From: Chris Hostetter Date: Tue, 17 Jan 2017 14:42:41 -0700 Subject: [PATCH] SOLR-9976: Fix init bug in SegmentsInfoRequestHandlerTest --- solr/CHANGES.txt | 5 +++++ .../admin/SegmentsInfoRequestHandlerTest.java | 20 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 5b96c20e3cc..42be8a292c1 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -90,6 +90,11 @@ Jetty 9.3.14.v20161028 Detailed Change List ---------------------- +Bug Fixes +---------------------- + +* SOLR-9976: Fix init bug in SegmentsInfoRequestHandlerTest (hossman) + Optimizations ---------------------- diff --git a/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java index 885e4198c78..1355e56125a 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java @@ -16,9 +16,11 @@ */ package org.apache.solr.handler.admin; +import org.apache.lucene.index.LogDocMergePolicy; import org.apache.lucene.util.Version; +import org.apache.solr.index.LogDocMergePolicyFactory; import org.apache.solr.util.AbstractSolrTestCase; -import org.junit.Before; + import org.junit.BeforeClass; import org.junit.Test; @@ -32,13 +34,17 @@ public class SegmentsInfoRequestHandlerTest extends AbstractSolrTestCase { @BeforeClass public static void beforeClass() throws Exception { - System.setProperty("enable.update.log", "false"); - System.setProperty("solr.tests.useMergePolicy", "false"); - initCore("solrconfig.xml", "schema12.xml"); - } - @Before - public void before() throws Exception { + // we need a consistent segmentation to ensure we don't get a random + // merge that reduces the total num docs in all segments, or the number of deletes + // + systemSetPropertySolrTestsMergePolicy(LogDocMergePolicy.class.getName()); + systemSetPropertySolrTestsMergePolicyFactory(LogDocMergePolicyFactory.class.getName()); + + System.setProperty("enable.update.log", "false"); // no _version_ in our schema + initCore("solrconfig.xml", "schema12.xml"); // segments API shouldn't depend on _version_ or ulog + + // build up an index with at least 2 segments and some deletes for (int i = 0; i < DOC_COUNT; i++) { assertU(adoc("id","SOLR100" + i, "name","Apache Solr:" + i)); }