SOLR-10195: Harden AbstractSolrMorphlineZkTestBase based tests.

This commit is contained in:
markrmiller 2017-02-22 19:50:19 -05:00
parent 1e206d820a
commit c53b7c33b0
1 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.cloud.AbstractDistribZkTestBase;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.SolrDocument;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.kitesdk.morphline.api.Collector;
@ -49,6 +50,10 @@ public abstract class AbstractSolrMorphlineZkTestBase extends SolrCloudTestCase
@BeforeClass
public static void setupCluster() throws Exception {
// set some system properties for use by tests
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
configureCluster(2)
.addConfig("conf", SOLR_CONF_DIR.toPath())
.configure();
@ -58,6 +63,12 @@ public abstract class AbstractSolrMorphlineZkTestBase extends SolrCloudTestCase
AbstractDistribZkTestBase.waitForRecoveriesToFinish(COLLECTION, cluster.getSolrClient().getZkStateReader(),
false, true, TIMEOUT);
}
@AfterClass
public static void afterClass() {
System.clearProperty("solr.test.sys.prop1");
System.clearProperty("solr.test.sys.prop2");
}
protected static final String RESOURCES_DIR = getFile("morphlines-core.marker").getParent();
private static final File SOLR_CONF_DIR = new File(RESOURCES_DIR + "/solr/collection1/conf");
@ -79,6 +90,7 @@ public abstract class AbstractSolrMorphlineZkTestBase extends SolrCloudTestCase
@Before
public void setup() throws Exception {
collector = new Collector();
cluster.waitForAllNodes(DEFAULT_TIMEOUT);
}
protected void commit() throws Exception {