From 461317062c833b0b38e09c41d31bfb0b472df0ec Mon Sep 17 00:00:00 2001 From: Ishan Chattopadhyaya Date: Mon, 16 Dec 2019 20:20:07 +0530 Subject: [PATCH] SOLR-14096: Stopping -Denable.packages=true from leaking to other tests --- .../solr/filestore/TestDistribPackageStore.java | 13 ++++++++++++- .../src/test/org/apache/solr/pkg/TestPackages.java | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/filestore/TestDistribPackageStore.java b/solr/core/src/test/org/apache/solr/filestore/TestDistribPackageStore.java index 64b1ef8e153..e90dd5ea2e0 100644 --- a/solr/core/src/test/org/apache/solr/filestore/TestDistribPackageStore.java +++ b/solr/core/src/test/org/apache/solr/filestore/TestDistribPackageStore.java @@ -47,6 +47,8 @@ import org.apache.solr.common.util.Utils; import org.apache.solr.util.LogLevel; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.server.ByteBufferInputStream; +import org.junit.After; +import org.junit.Before; import static org.apache.solr.common.util.Utils.JAVABINCONSUMER; import static org.apache.solr.core.TestDynamicLoading.getFileContent; @@ -54,8 +56,17 @@ import static org.apache.solr.core.TestDynamicLoading.getFileContent; @LogLevel("org.apache.solr.filestore.PackageStoreAPI=DEBUG;org.apache.solr.filestore.DistribPackageStore=DEBUG") public class TestDistribPackageStore extends SolrCloudTestCase { - public void testPackageStoreManagement() throws Exception { + @Before + public void setup() { System.setProperty("enable.packages", "true"); + } + + @After + public void teardown() { + System.clearProperty("enable.packages"); + } + + public void testPackageStoreManagement() throws Exception { MiniSolrCloudCluster cluster = configureCluster(4) .withJettyConfig(jetty -> jetty.enableV2(true)) diff --git a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java index e5e922431f0..560cdea72d6 100644 --- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java +++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java @@ -50,6 +50,8 @@ import org.apache.solr.filestore.TestDistribPackageStore; import org.apache.solr.util.LogLevel; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.data.Stat; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import static org.apache.solr.common.cloud.ZkStateReader.SOLR_PKGS_PATH; @@ -63,9 +65,18 @@ import static org.apache.solr.filestore.TestDistribPackageStore.waitForAllNodesH //@org.apache.lucene.util.LuceneTestCase.AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-13822") // leaks files public class TestPackages extends SolrCloudTestCase { + @Before + public void setup() { + System.setProperty("enable.packages", "true"); + } + + @After + public void teardown() { + System.clearProperty("enable.packages"); + } + @Test public void testPluginLoading() throws Exception { - System.setProperty("enable.packages", "true"); MiniSolrCloudCluster cluster = configureCluster(4) .withJettyConfig(jetty -> jetty.enableV2(true))