diff --git a/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java b/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java index ba2946ee814..e9ff3f254d4 100644 --- a/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java +++ b/solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java @@ -32,7 +32,6 @@ import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.core.SolrCore; -import org.junit.AfterClass; import org.junit.BeforeClass; public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 { @@ -46,9 +45,6 @@ public static void beforeClass() throws Exception { initCore("solrconfig.xml", "schema.xml", tmpSolrHome); } - @AfterClass - public static void AfterClass() {} - public void testStopwordsAfterCoreReload() throws Exception { SolrInputDocument doc = new SolrInputDocument(); doc.setField("id", "42"); diff --git a/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java b/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java index e7213bc3de5..ff03724fb85 100644 --- a/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java +++ b/solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java @@ -20,7 +20,6 @@ import java.nio.file.Path; import org.apache.commons.io.file.PathUtils; import org.apache.solr.common.params.ModifiableSolrParams; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -50,9 +49,6 @@ public static void beforeClass() throws Exception { initCore("solrconfig-minimal.xml", "schema-tiny.xml", tmpSolrHome, "core1"); } - @AfterClass - public static void AfterClass() {} - @Test public void testCorrectCore() { assertEquals("should be core1", "core1", h.getCore().getName()); diff --git a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java b/solr/core/src/test/org/apache/solr/TestGroupingSearch.java index e82223ec13c..c408cfc3332 100644 --- a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java +++ b/solr/core/src/test/org/apache/solr/TestGroupingSearch.java @@ -42,7 +42,6 @@ import org.apache.solr.response.ResultContext; import org.apache.solr.response.SolrQueryResponse; import org.apache.solr.schema.IndexSchema; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -74,11 +73,6 @@ public static void beforeTests() throws Exception { initCore("solrconfig.xml", "schema12.xml"); } - @AfterClass - public static void afterTests() { - systemClearPropertySolrTestsMergePolicyFactory(); - } - @Before public void cleanIndex() { assertU(delQ("*:*")); diff --git a/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java b/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java index 7331bb8ddde..c4c44b20146 100644 --- a/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java +++ b/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java @@ -21,7 +21,6 @@ import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrInputDocument; -import org.junit.AfterClass; import org.junit.Test; /** @@ -34,9 +33,6 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase { private static final String group_ti1 = "group_ti1"; private static final String shard_i1 = "shard_i1"; - @AfterClass - public static void afterClass() throws Exception {} - @Test @ShardsFixed(num = 2) public void test() throws Exception { @@ -79,7 +75,7 @@ private void basicTest() throws Exception { id_s1)); // The number of highlighted documents should be the same as the de-duplicated docs - assertEquals(1, rsp.getHighlighting().values().size()); + assertEquals(1, rsp.getHighlighting().size()); } private void randomizedTest() throws Exception { @@ -142,7 +138,7 @@ private void randomizedTest() throws Exception { "true")); // The number of highlighted documents should be the same as the de-duplicated docs for this // group - assertEquals(docsInGroup[group], rsp.getHighlighting().values().size()); + assertEquals(docsInGroup[group], rsp.getHighlighting().size()); } } diff --git a/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java b/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java index 9d777620baf..e8cb48874b6 100644 --- a/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java +++ b/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java @@ -78,12 +78,9 @@ public static void setupClusterWithSecurityEnabled() throws Exception { @AfterClass public static void teardown() throws Exception { - try { - if (repositoryServer != null) { - repositoryServer.stop(); - } - } finally { - System.clearProperty("solr.packages.enabled"); + + if (repositoryServer != null) { + repositoryServer.stop(); } } diff --git a/solr/core/src/test/org/apache/solr/cli/SolrProcessManagerTest.java b/solr/core/src/test/org/apache/solr/cli/SolrProcessManagerTest.java index 6b37c03d802..e1bb9d51cd0 100644 --- a/solr/core/src/test/org/apache/solr/cli/SolrProcessManagerTest.java +++ b/solr/core/src/test/org/apache/solr/cli/SolrProcessManagerTest.java @@ -71,8 +71,6 @@ public static void afterClass() throws Exception { processHttp.getValue().destroyForcibly(); processHttps.getValue().destroyForcibly(); SolrProcessManager.enableTestingMode = false; - System.clearProperty("solr.port.listen"); - System.clearProperty("solr.pid.dir"); } private static int findAvailablePort() throws IOException { diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java index 653adb6d74e..db26383eb7f 100644 --- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java +++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java @@ -47,7 +47,6 @@ import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.util.ExternalPaths; import org.junit.After; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -68,14 +67,6 @@ public static void beforeClass() { System.setProperty("solr.directoryFactory", "solr.NRTCachingDirectoryFactory"); } - @AfterClass - public static void cleanup() { - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.host.advertise"); - System.clearProperty("solr.port.listen"); - System.clearProperty("solr.log.dir"); - } - /** * Overrides the call to exec bin/solr to start Solr nodes to start them using the Solr * test-framework instead of the script, since the script depends on a full build. diff --git a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java index afdc3ad81cd..b3a82f029a8 100644 --- a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java +++ b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java @@ -44,7 +44,6 @@ import org.apache.solr.util.ExternalPaths; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -72,11 +71,6 @@ public static void beforeClass() { System.setProperty("solrcloud.skip.autorecovery", "true"); } - @AfterClass - public static void afterClass() { - System.clearProperty("solrcloud.skip.autorecovery"); - } - @Override public void setUp() throws Exception { super.setUp(); @@ -568,34 +562,25 @@ public void testSetClusterProperty() throws Exception { @Test public void testUpdateAcls() throws Exception { - try { - System.setProperty( - SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME, - DigestZkACLProvider.class.getName()); - System.setProperty( - VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, "user"); - System.setProperty( - VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, "pass"); - System.setProperty( - SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME, - VMParamsAllAndReadonlyDigestZkACLProvider.class.getName()); - System.setProperty( - VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, - "user"); - System.setProperty( - VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, - "pass"); - - String[] args = new String[] {"updateacls", "/", "-z", zkServer.getZkAddress()}; - assertEquals(0, CLITestHelper.runTool(args, UpdateACLTool.class)); - } finally { - // Need to clear these before we open the next SolrZkClient - System.clearProperty(SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME); - System.clearProperty( - VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME); - System.clearProperty( - VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME); - } + + System.setProperty( + SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME, DigestZkACLProvider.class.getName()); + System.setProperty( + VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, "user"); + System.setProperty( + VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, "pass"); + System.setProperty( + SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME, + VMParamsAllAndReadonlyDigestZkACLProvider.class.getName()); + System.setProperty( + VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, + "user"); + System.setProperty( + VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, + "pass"); + + String[] args = new String[] {"updateacls", "/", "-z", zkServer.getZkAddress()}; + assertEquals(0, CLITestHelper.runTool(args, UpdateACLTool.class)); boolean excepted = false; try (SolrZkClient zkClient = @@ -619,8 +604,6 @@ public void tearDown() throws Exception { if (zkServer != null) { zkServer.shutdown(); } - System.clearProperty("solr.home"); - System.clearProperty("minStateByteLenForCompression"); System.setOut(originalSystemOut); super.tearDown(); } diff --git a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerSchemaAPI.java b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerSchemaAPI.java index c0a4a3aaecc..98b76fd57a2 100644 --- a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerSchemaAPI.java +++ b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerSchemaAPI.java @@ -64,7 +64,6 @@ public static void destroyClass() throws IOException { server.close(); server = null; } - System.clearProperty("managed.schema.mutable"); } @Before diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java index 3f4ab451c85..b8640c9a3d4 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java @@ -54,7 +54,6 @@ public static void beforeSuperClass() { @AfterClass public static void afterSuperClass() { - System.clearProperty("solr.autoCommit.maxTime"); clearErrorHook(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java index cd0f2fcf41f..b70939ced42 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java @@ -74,7 +74,6 @@ public static void beforeSuperClass() { @AfterClass public static void afterSuperClass() { - System.clearProperty("solr.autoCommit.maxTime"); clearErrorHook(); TestInjection.reset(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java index a75b637af22..c521159d316 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java @@ -51,7 +51,6 @@ public static void beforeSuperClass() { @AfterClass public static void afterSuperClass() { - System.clearProperty("solr.autoCommit.maxTime"); clearErrorHook(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java index 95d1c1789ee..38c6920cf52 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java @@ -76,7 +76,6 @@ public static void beforeSuperClass() { @AfterClass public static void afterSuperClass() { - System.clearProperty("solr.autoCommit.maxTime"); clearErrorHook(); TestInjection.reset(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java index b3a3cc72865..a9f73cdaf2f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java @@ -25,7 +25,6 @@ import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.embedded.JettySolrRunner; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -37,12 +36,6 @@ public static void beforeClass() throws Exception { configureCluster(3).addConfig("conf", configset("cloud-minimal")).configure(); } - @AfterClass - public static void afterClass() throws Exception { - shutdownCluster(); - System.clearProperty("solrcloud.skip.autorecovery"); - } - @Test public void testCoreRegistration() throws Exception { System.setProperty("solrcloud.update.delay", "1"); diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java index f2ca9c01367..57c84aaf41b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java @@ -25,7 +25,6 @@ import org.apache.solr.common.cloud.ZkNodeProps; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.embedded.JettySolrRunner; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -153,9 +152,4 @@ private String getLeader(String collection) throws InterruptedException { return props.getStr(ZkStateReader.NODE_NAME_PROP); } - - @AfterClass - public static void afterClass() { - System.clearProperty("solrcloud.skip.autorecovery"); - } } diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java index c32b4694f95..db978da4b36 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java @@ -61,9 +61,6 @@ public void distribTearDown() throws Exception { if (!success) { printLayoutOnTearDown = true; } - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("tests.zk.violationReportAction"); super.distribTearDown(); } @@ -93,78 +90,71 @@ public void test() throws Exception { handle.clear(); handle.put("timestamp", SKIPVAL); - try { - CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1"); - List otherJetties = getOtherAvailableJetties(initialLeaderJetty); + CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1"); + List otherJetties = getOtherAvailableJetties(initialLeaderJetty); + log.info( + "Leader node_name: {}, url: {}", initialLeaderJetty.coreNodeName, initialLeaderJetty.url); + for (CloudJettyRunner cloudJettyRunner : otherJetties) { log.info( - "Leader node_name: {}, url: {}", - initialLeaderJetty.coreNodeName, - initialLeaderJetty.url); - for (CloudJettyRunner cloudJettyRunner : otherJetties) { - log.info( - "Non-leader node_name: {}, url: {}", - cloudJettyRunner.coreNodeName, - cloudJettyRunner.url); - } + "Non-leader node_name: {}, url: {}", + cloudJettyRunner.coreNodeName, + cloudJettyRunner.url); + } - CloudJettyRunner secondNode = otherJetties.get(0); - CloudJettyRunner freshNode = otherJetties.get(1); + CloudJettyRunner secondNode = otherJetties.get(0); + CloudJettyRunner freshNode = otherJetties.get(1); - // shutdown a node to simulate fresh start - otherJetties.remove(freshNode); - forceNodeFailures(singletonList(freshNode)); + // shutdown a node to simulate fresh start + otherJetties.remove(freshNode); + forceNodeFailures(singletonList(freshNode)); - del("*:*"); - waitForThingsToLevelOut(30, TimeUnit.SECONDS); + del("*:*"); + waitForThingsToLevelOut(30, TimeUnit.SECONDS); - checkShardConsistency(false, true); + checkShardConsistency(false, true); - // index a few docs and commit - for (int i = 0; i < 100; i++) { - indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); - } - commit(); - waitForThingsToLevelOut(30, TimeUnit.SECONDS); - - checkShardConsistency(false, true); - - // bring down the other node and index a few docs; so the leader and other node segments - // diverge - forceNodeFailures(singletonList(secondNode)); - for (int i = 0; i < 10; i++) { - indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); - if (i % 2 == 0) { - commit(); - } + // index a few docs and commit + for (int i = 0; i < 100; i++) { + indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); + } + commit(); + waitForThingsToLevelOut(30, TimeUnit.SECONDS); + + checkShardConsistency(false, true); + + // bring down the other node and index a few docs; so the leader and other node segments + // diverge + forceNodeFailures(singletonList(secondNode)); + for (int i = 0; i < 10; i++) { + indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); + if (i % 2 == 0) { + commit(); } - commit(); - restartNodes(singletonList(secondNode)); - - // start the freshNode - restartNodes(singletonList(freshNode)); - String coreName = freshNode.jetty.getCoreContainer().getCores().iterator().next().getName(); - Path replicationProperties = - Path.of( - freshNode.jetty.getSolrHome(), "cores", coreName, "data", "replication.properties"); - String md5 = DigestUtils.md5Hex(Files.readAllBytes(replicationProperties)); - - // shutdown the original leader - log.info("Now shutting down initial leader"); - forceNodeFailures(singletonList(initialLeaderJetty)); - waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info); - waitTillNodesActive(); - log.info("Updating mappings from zk"); - updateMappingsFromZk(jettys, clients, true); - assertEquals( - "Node went into replication", - md5, - DigestUtils.md5Hex(Files.readAllBytes(replicationProperties))); - - success = true; - } finally { - System.clearProperty("solr.index.replication.fingerprint.enabled"); } + commit(); + restartNodes(singletonList(secondNode)); + + // start the freshNode + restartNodes(singletonList(freshNode)); + String coreName = freshNode.jetty.getCoreContainer().getCores().iterator().next().getName(); + Path replicationProperties = + Path.of(freshNode.jetty.getSolrHome(), "cores", coreName, "data", "replication.properties"); + String md5 = DigestUtils.md5Hex(Files.readAllBytes(replicationProperties)); + + // shutdown the original leader + log.info("Now shutting down initial leader"); + forceNodeFailures(singletonList(initialLeaderJetty)); + waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info); + waitTillNodesActive(); + log.info("Updating mappings from zk"); + updateMappingsFromZk(jettys, clients, true); + assertEquals( + "Node went into replication", + md5, + DigestUtils.md5Hex(Files.readAllBytes(replicationProperties))); + + success = true; } private void restartNodes(List nodesToRestart) throws Exception { diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java index 01b8f4d1368..c8d84db706d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java @@ -75,11 +75,6 @@ public static void setupCluster() { public static void tearDownCluster() { proxies = null; jettys = null; - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("leaderVoteWait"); - System.clearProperty("distribUpdateSoTimeout"); - System.clearProperty("distribUpdateConnTimeout"); } @Before diff --git a/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java b/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java index d6e2af67301..502bd83a1e7 100644 --- a/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java @@ -78,7 +78,6 @@ public void teardown() throws Exception { // test did not initialize, cleanup is No-Op; return; } - System.clearProperty("CoreInitFailedAction"); CollectionAdminRequest.deleteCollection(collection).process(cluster.getSolrClient()); } diff --git a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java index 12e84a97a42..a29d083b6c8 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java @@ -30,7 +30,6 @@ import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.data.ACL; import org.apache.zookeeper.data.Stat; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -51,11 +50,6 @@ public static void beforeClass() { System.setProperty("solrcloud.skip.autorecovery", "true"); } - @AfterClass - public static void afterClass() { - System.clearProperty("solrcloud.skip.autorecovery"); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java index 7d0eeba82a3..004a3e7c737 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java @@ -41,7 +41,6 @@ import org.apache.solr.common.cloud.ZkCredentialsProvider; import org.apache.solr.common.util.StrUtils; import org.apache.zookeeper.CreateMode; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -62,11 +61,6 @@ public static void beforeClass() { System.setProperty("solrcloud.skip.autorecovery", "true"); } - @AfterClass - public static void afterClass() { - System.clearProperty("solrcloud.skip.autorecovery"); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java index 84666910816..c982e143c20 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java @@ -372,8 +372,6 @@ public static void afterClass() throws Exception { zkClient.printLayoutToStream(System.out); } - System.clearProperty("solr.zookeeper.client.timeout"); - if (null != server) { server.shutdown(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java index 47b75827a70..e89b9890bd2 100644 --- a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java @@ -67,10 +67,6 @@ public void distribTearDown() throws Exception { if (!success) { printLayoutOnTearDown = true; } - System.clearProperty("distribUpdateSoTimeout"); - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("tests.zk.violationReportAction"); super.distribTearDown(); } @@ -114,107 +110,101 @@ public void test() throws Exception { commit(); waitForThingsToLevelOut(30, TimeUnit.SECONDS); - try { - checkShardConsistency(false, true); + checkShardConsistency(false, true); - long cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound(); - assertEquals(docId, cloudClientDocs); + long cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound(); + assertEquals(docId, cloudClientDocs); - CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1"); - List otherJetties = getOtherAvailableJetties(initialLeaderJetty); - CloudJettyRunner neverLeader = otherJetties.get(otherJetties.size() - 1); - otherJetties.remove(neverLeader); + CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1"); + List otherJetties = getOtherAvailableJetties(initialLeaderJetty); + CloudJettyRunner neverLeader = otherJetties.get(otherJetties.size() - 1); + otherJetties.remove(neverLeader); - // first shutdown a node that will never be a leader - forceNodeFailures(singletonList(neverLeader)); + // first shutdown a node that will never be a leader + forceNodeFailures(singletonList(neverLeader)); - // node failure and recovery via PeerSync - log.info("Forcing PeerSync"); - CloudJettyRunner nodePeerSynced = forceNodeFailureAndDoPeerSync(true); + // node failure and recovery via PeerSync + log.info("Forcing PeerSync"); + CloudJettyRunner nodePeerSynced = forceNodeFailureAndDoPeerSync(true); - // add a few more docs - indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); - indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); - commit(); - - cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound(); - assertEquals(docId, cloudClientDocs); - - // now shutdown all other nodes except for 'nodeShutDownForFailure' - otherJetties.remove(nodePeerSynced); - forceNodeFailures(otherJetties); - waitForThingsToLevelOut(30, TimeUnit.SECONDS); - checkShardConsistency(false, true); - - // now shutdown the original leader - log.info("Now shutting down initial leader"); - forceNodeFailures(singletonList(initialLeaderJetty)); - log.info("Updating mappings from zk"); - waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info); - updateMappingsFromZk(jettys, clients, true); - assertEquals( - "PeerSynced node did not become leader", - nodePeerSynced, - shardToLeaderJetty.get("shard1")); - - // bring up node that was down all along, and let it PeerSync from the node that was forced to - // PeerSync - bringUpDeadNodeAndEnsureNoReplication(neverLeader, false); - waitTillNodesActive(); - - checkShardConsistency(false, true); - - // bring back all the nodes including initial leader - // (commented as reports Maximum concurrent create/delete watches above limit violation and - // reports thread leaks) - /*for(int i = 0 ; i < nodesDown.size(); i++) { - bringUpDeadNodeAndEnsureNoReplication(shardToLeaderJetty.get("shard1"), neverLeader, false); - } - checkShardConsistency(false, true);*/ + // add a few more docs + indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); + indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++); + commit(); + + cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound(); + assertEquals(docId, cloudClientDocs); - // make sure leader has not changed after bringing initial leader back - assertEquals(nodePeerSynced, shardToLeaderJetty.get("shard1")); + // now shutdown all other nodes except for 'nodeShutDownForFailure' + otherJetties.remove(nodePeerSynced); + forceNodeFailures(otherJetties); + waitForThingsToLevelOut(30, TimeUnit.SECONDS); + checkShardConsistency(false, true); + + // now shutdown the original leader + log.info("Now shutting down initial leader"); + forceNodeFailures(singletonList(initialLeaderJetty)); + log.info("Updating mappings from zk"); + waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info); + updateMappingsFromZk(jettys, clients, true); + assertEquals( + "PeerSynced node did not become leader", nodePeerSynced, shardToLeaderJetty.get("shard1")); + + // bring up node that was down all along, and let it PeerSync from the node that was forced to + // PeerSync + bringUpDeadNodeAndEnsureNoReplication(neverLeader, false); + waitTillNodesActive(); - // assert metrics - SolrMetricManager manager = nodePeerSynced.jetty.getCoreContainer().getMetricManager(); - MeterProvider registry = null; - for (String name : manager.registryNames()) { - if (name.startsWith("solr.core.collection1")) { - registry = manager.meterProvider(name); - break; - } - } - assertNotNull(registry); - CoreContainer cc = nodePeerSynced.jetty.getCoreContainer(); - String coreName = - cc.getAllCoreNames().stream() - .filter(n -> n.contains(DEFAULT_TEST_COLLECTION_NAME)) - .findFirst() - .orElseThrow( - () -> - new IllegalStateException( - "Couldn't find core for " + nodePeerSynced.coreNodeName)); - try (SolrCore core = cc.getCore(coreName)) { - assertTrue( - SolrMetricTestUtils.getHistogramDatapoint( - core, - "solr_core_sync_with_leader_time_milliseconds", - SolrMetricTestUtils.newCloudLabelsBuilder(core) - .label("category", "REPLICATION") - .build()) - .hasCount()); - assertNull( - SolrMetricTestUtils.getCounterDatapoint( - core, - "solr_core_sync_with_leader_sync_errors", - SolrMetricTestUtils.newCloudLabelsBuilder(core) - .label("category", "REPLICATION") - .build())); + checkShardConsistency(false, true); + + // bring back all the nodes including initial leader + // (commented as reports Maximum concurrent create/delete watches above limit violation and + // reports thread leaks) + /*for(int i = 0 ; i < nodesDown.size(); i++) { + bringUpDeadNodeAndEnsureNoReplication(shardToLeaderJetty.get("shard1"), neverLeader, false); + } + checkShardConsistency(false, true);*/ + + // make sure leader has not changed after bringing initial leader back + assertEquals(nodePeerSynced, shardToLeaderJetty.get("shard1")); + + // assert metrics + SolrMetricManager manager = nodePeerSynced.jetty.getCoreContainer().getMetricManager(); + MeterProvider registry = null; + for (String name : manager.registryNames()) { + if (name.startsWith("solr.core.collection1")) { + registry = manager.meterProvider(name); + break; } - success = true; - } finally { - System.clearProperty("solr.index.replication.fingerprint.enabled"); } + assertNotNull(registry); + CoreContainer cc = nodePeerSynced.jetty.getCoreContainer(); + String coreName = + cc.getAllCoreNames().stream() + .filter(n -> n.contains(DEFAULT_TEST_COLLECTION_NAME)) + .findFirst() + .orElseThrow( + () -> + new IllegalStateException( + "Couldn't find core for " + nodePeerSynced.coreNodeName)); + try (SolrCore core = cc.getCore(coreName)) { + assertTrue( + SolrMetricTestUtils.getHistogramDatapoint( + core, + "solr_core_sync_with_leader_time_milliseconds", + SolrMetricTestUtils.newCloudLabelsBuilder(core) + .label("category", "REPLICATION") + .build()) + .hasCount()); + assertNull( + SolrMetricTestUtils.getCounterDatapoint( + core, + "solr_core_sync_with_leader_sync_errors", + SolrMetricTestUtils.newCloudLabelsBuilder(core) + .label("category", "REPLICATION") + .build())); + } + success = true; } class IndexInBackGround extends Thread { diff --git a/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java b/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java index bcdea64ae31..b35a937726b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java @@ -57,9 +57,6 @@ public static void beforeTests() { @AfterClass public static void afterTest() { - System.clearProperty("solr.tests.maxBufferedDocs"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("useCompoundFile"); TestInjection.reset(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java b/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java index 22b0084e989..549ef2b5c78 100644 --- a/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java @@ -24,7 +24,6 @@ import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.cloud.ZkStateReader; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -66,13 +65,6 @@ public static void beforeRestartWhileUpdatingTest() { // SOLR-13189 // TestInjection.failReplicaRequests = "true:03"; } - @AfterClass - public static void afterRestartWhileUpdatingTest() { - System.clearProperty("leaderVoteWait"); - System.clearProperty("solr.autoCommit.maxTime"); - System.clearProperty("solr.autoSoftCommit.maxTime"); - } - @Test public void test() throws Exception { handle.clear(); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java index 70fb6eb9812..28267f29912 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java @@ -83,7 +83,6 @@ public void testBasics() throws Exception { @Override public void tearDown() throws Exception { - System.clearProperty("solr.security.auth.plugin"); shutdownCluster(); super.tearDown(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java index 5fc8bf904a8..23b6721de33 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java @@ -36,7 +36,6 @@ import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.search.similarities.CustomSimilarityFactory; import org.apache.solr.search.stats.StatsCache; -import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -98,12 +97,6 @@ protected void createTestCollection() throws Exception { indexDocs(control, "collection1", NUM_DOCS, 0, generator); } - @After - public void tearDownCluster() { - System.clearProperty("solr.statsCache"); - System.clearProperty("solr.similarity"); - } - @Test @SuppressWarnings({"unchecked"}) public void testBasicStats() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java index 84035e40e90..edae061cbb8 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java @@ -87,9 +87,6 @@ public void tearDownCluster() throws Exception { proxies = null; } jettys = null; - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("leaderVoteWait"); shutdownCluster(); } @@ -274,7 +271,7 @@ private void addDocWhenOtherReplicasAreNetworkPartitioned( proxies.get(cluster.getJettySolrRunner(0)).reopen(); cluster.getJettySolrRunner(0).start(); cluster.waitForAllNodes(30); - ; + waitForState( "Timeout waiting for leader", collection, diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java index d87bf88439c..c720012adfd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java @@ -108,7 +108,6 @@ import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat; import org.junit.After; -import org.junit.AfterClass; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -127,11 +126,6 @@ public static void setUpClass() throws Exception { configureCluster(1).withSecurityJson(getSecurityJson()).configure(); } - @AfterClass - public static void tearDownClass() { - System.clearProperty("managed.schema.mutable"); - } - private static ConfigSetService getConfigSetService() { return cluster.getOpenOverseer().getCoreContainer().getConfigSetService(); } @@ -417,18 +411,15 @@ public void testUploadDisabled(boolean v2) throws Exception { ignoreException("Configset upload feature is disabled"); for (boolean enabled : new boolean[] {true, false}) { System.setProperty("solr.configset.upload.enabled", String.valueOf(enabled)); - try { - long statusCode = - uploadConfigSet("regular", "test-enabled-is-" + enabled, null, zkClient, v2); - assertEquals( - "ConfigSet upload enabling/disabling not working as expected for enabled=" - + enabled - + ".", - enabled ? 0l : 400l, - statusCode); - } finally { - System.clearProperty("solr.configset.upload.enabled"); - } + + long statusCode = + uploadConfigSet("regular", "test-enabled-is-" + enabled, null, zkClient, v2); + assertEquals( + "ConfigSet upload enabling/disabling not working as expected for enabled=" + + enabled + + ".", + enabled ? 0l : 400l, + statusCode); } unIgnoreException("Configset upload feature is disabled"); } diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIShareSchema.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIShareSchema.java index cc78567dd28..cda2bd0b025 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIShareSchema.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIShareSchema.java @@ -22,7 +22,6 @@ import org.apache.solr.core.CoreContainer; import org.apache.solr.core.SolrCore; import org.junit.After; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -45,11 +44,6 @@ public void doAfter() throws Exception { cluster.deleteAllCollections(); } - @AfterClass - public static void doAfterClass() { - System.clearProperty("shareSchema"); - } - @Test public void testConfigSetDeleteWhenInUse() throws Exception { CollectionAdminRequest.createCollection("test_configset_delete", "conf1", 1, 1) diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPrepRecovery.java b/solr/core/src/test/org/apache/solr/cloud/TestPrepRecovery.java index 6f73cc0e53e..30649e254e8 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestPrepRecovery.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestPrepRecovery.java @@ -23,7 +23,6 @@ import org.apache.solr.common.cloud.Replica; import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.util.TestInjection; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -46,11 +45,6 @@ public static void setupCluster() throws Exception { .configure(); } - @AfterClass - public static void tearCluster() { - System.clearProperty("leaderConflictResolveWait"); - } - @Test public void testLeaderUnloaded() throws Exception { CloudSolrClient solrClient = cluster.getSolrClient(); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java index e0d095b6559..d0c1e2d6fe3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java @@ -99,8 +99,6 @@ public static void createTestCluster() throws Exception { @AfterClass public static void tearDownCluster() { - System.clearProperty("solr.solrj.cloud.max.stale.retries"); - System.clearProperty("zkReaderGetLeaderRetryTimeoutMs"); TestInjection.reset(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java b/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java index ee4bab45620..bc863239672 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java @@ -60,8 +60,6 @@ public static void setupCluster() throws Exception { @After public void ensureClusterEmpty() throws Exception { cluster.deleteAllCollections(); - System.clearProperty("mergePolicySort"); - System.clearProperty("solr.tests.id.docValues"); } @Before diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplayVsRecovery.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplayVsRecovery.java index efc7935813a..f41cfb8a72d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplayVsRecovery.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplayVsRecovery.java @@ -106,9 +106,6 @@ public void tearDownCluster() throws Exception { proxies = null; } jettys = null; - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.ulog.numRecordsToKeep"); - System.clearProperty("leaderVoteWait"); shutdownCluster(); } diff --git a/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java b/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java index 2fbd5128177..585d649ecf6 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java @@ -27,7 +27,6 @@ import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.util.TestInjection; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -37,7 +36,7 @@ public class TlogReplayBufferedWhileIndexingTest extends AbstractFullDistribZkTe private List threads; - public TlogReplayBufferedWhileIndexingTest() throws Exception { + public TlogReplayBufferedWhileIndexingTest() { super(); sliceCount = 1; fixShardCount(2); @@ -54,13 +53,6 @@ public static void beforeRestartWhileUpdatingTest() throws Exception { useFactory("solr.StandardDirectoryFactory"); } - @AfterClass - public static void afterRestartWhileUpdatingTest() { - System.clearProperty("leaderVoteWait"); - System.clearProperty("solr.autoCommit.maxTime"); - System.clearProperty("solr.autoSoftCommit.maxTime"); - } - @Test public void test() throws Exception { handle.clear(); diff --git a/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java index 7ea461d323d..81d36d45723 100644 --- a/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java @@ -40,7 +40,6 @@ import org.apache.solr.common.cloud.ZkCredentialsInjector; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException.NoAuthException; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -66,11 +65,6 @@ public static void beforeClass() { System.setProperty("solrcloud.skip.autorecovery", "true"); } - @AfterClass - public static void afterClass() { - System.clearProperty("solrcloud.skip.autorecovery"); - } - @Override public void setUp() throws Exception { // TODO: Does all of this setup need to happen for each test case, or can it be done once for diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/BackupRestoreApiErrorConditionsTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/BackupRestoreApiErrorConditionsTest.java index 42cbeb4661c..b91014bc2c4 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/BackupRestoreApiErrorConditionsTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/BackupRestoreApiErrorConditionsTest.java @@ -20,7 +20,6 @@ import org.apache.solr.client.solrj.response.RequestStatusState; import org.apache.solr.cloud.MiniSolrCloudCluster; import org.apache.solr.cloud.SolrCloudTestCase; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -76,11 +75,6 @@ public static void setUpClass() throws Exception { assertEquals(RequestStatusState.COMPLETED, backupState); } - @AfterClass - public static void tearDownClass() { - System.clearProperty("solr.security.allow.paths"); - } - @Test public void testBackupOperationsReportErrorWhenUnknownBackupRepositoryRequested() { // Check message for create-backup diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java index 7166057abe1..f464523d406 100644 --- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java @@ -45,7 +45,6 @@ import org.apache.solr.handler.admin.ConfigSetsHandler; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,12 +63,6 @@ public static void setup() { System.setProperty("solr.OverseerStateUpdateBatchSize", "10"); } - @AfterClass - public static void cleanup() { - System.clearProperty("solr.OverseerStateUpdateDelay"); - System.clearProperty("solr.OverseerStateUpdateBatchSize"); - } - public void testZkStateWriterBatching() throws Exception { Path zkDir = createTempDir("testZkStateWriterBatching"); diff --git a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java index d2e3ded32ea..6f217be9644 100644 --- a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java +++ b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java @@ -88,7 +88,6 @@ public void setUp() throws Exception { @After public void teardown() throws Exception { - System.clearProperty("solr.packages.enabled"); if (eventsListener != null) { cluster .getOpenOverseer() diff --git a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java index 8bbb3f58043..3328f7b00b0 100755 --- a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java +++ b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java @@ -23,7 +23,6 @@ import org.apache.lucene.tests.mockfile.FilterPath; import org.apache.solr.SolrTestCase; import org.apache.solr.common.util.NamedList; -import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -48,7 +47,6 @@ public static void cleanupLoader() throws Exception { loader = null; } - @After @Before public void clean() { System.clearProperty("solr.data.home"); diff --git a/solr/core/src/test/org/apache/solr/core/TestBadConfig.java b/solr/core/src/test/org/apache/solr/core/TestBadConfig.java index b992436c5f9..a1ea1c18a6f 100644 --- a/solr/core/src/test/org/apache/solr/core/TestBadConfig.java +++ b/solr/core/src/test/org/apache/solr/core/TestBadConfig.java @@ -27,13 +27,8 @@ public void testNRTModeProperty() throws Exception { } public void testUpdateLogButNoVersionField() throws Exception { - System.setProperty("solr.index.updatelog.enabled", "true"); - try { - assertConfigs("solrconfig.xml", "schema12.xml", "_version_"); - } finally { - System.clearProperty("solr.index.updatelog.enabled"); - } + assertConfigs("solrconfig.xml", "schema12.xml", "_version_"); } public void testBogusMergePolicy() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java index 71fdd759d1d..21cc30154e2 100644 --- a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java +++ b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java @@ -120,12 +120,8 @@ private void doTestCompressionMode(String propertyValue, String expectedModeStri if (propertyValue != null) { System.setProperty("tests.COMPRESSION_MODE", propertyValue); } - try { - reloadCoreAndRecreateIndex(); - assertCompressionMode(expectedModeString, h.getCore()); - } finally { - System.clearProperty("tests.COMPRESSION_MODE"); - } + reloadCoreAndRecreateIndex(); + assertCompressionMode(expectedModeString, h.getCore()); } protected void assertCompressionMode(String expectedModeString, SolrCore core) @@ -186,7 +182,6 @@ public void testMixedCompressionMode() throws Exception { assertQ(req("q", "text:foo"), "//*[@numFound='3']"); assertU(optimize("maxSegments", "1")); assertCompressionMode("BEST_SPEED", h.getCore()); - System.clearProperty("tests.COMPRESSION_MODE"); } public void testBadCompressionMode() { diff --git a/solr/core/src/test/org/apache/solr/core/TestConfig.java b/solr/core/src/test/org/apache/solr/core/TestConfig.java index a785b3c731b..94bd4c74a30 100644 --- a/solr/core/src/test/org/apache/solr/core/TestConfig.java +++ b/solr/core/src/test/org/apache/solr/core/TestConfig.java @@ -104,12 +104,6 @@ public void testCacheEnablingDisabling() throws Exception { assertEquals(2, sc.userCacheConfigs.size()); assertNotNull(sc.userCacheConfigs.get("user_defined_cache_XXX")); assertNotNull(sc.userCacheConfigs.get("user_defined_cache_ZZZ")); - - System.clearProperty("user_defined_cache_XXX.enabled"); - System.clearProperty("user_defined_cache_ZZZ.enabled"); - System.clearProperty("filterCache.enabled"); - System.clearProperty("queryResultCache.enabled"); - System.clearProperty("documentCache.enabled"); } // If defaults change, add test methods to cover each version diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java index de48a7c2276..2ded0c3ff4e 100644 --- a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java +++ b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java @@ -45,7 +45,6 @@ import org.apache.solr.handler.admin.InfoHandler; import org.apache.solr.servlet.SolrDispatchFilter; import org.apache.solr.util.ModuleUtils; -import org.junit.AfterClass; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -53,24 +52,13 @@ public class TestCoreContainer extends SolrTestCaseJ4 { - private static String oldSolrHome; private static final String SOLR_HOME_PROP = "solr.solr.home"; @BeforeClass public static void beforeClass() { - oldSolrHome = System.getProperty(SOLR_HOME_PROP); System.setProperty("configsets", getFile("solr/configsets").toAbsolutePath().toString()); } - @AfterClass - public static void afterClass() { - if (oldSolrHome != null) { - System.setProperty(SOLR_HOME_PROP, oldSolrHome); - } else { - System.clearProperty(SOLR_HOME_PROP); - } - } - private CoreContainer init(String xml) throws Exception { Path solrHomeDirectory = createTempDir(); return init(solrHomeDirectory, xml); @@ -119,7 +107,6 @@ public void testShareSchema() throws Exception { } finally { cores.shutdown(); - System.clearProperty("shareSchema"); } } @@ -466,8 +453,6 @@ public void testModuleLibs() throws Exception { SolrException.class, () -> init(tmpRoot, "nope")); assertEquals("No module with name nope", ex.getMessage()); - - System.clearProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE); } @Test @@ -640,7 +625,6 @@ public void assertAllowPathFromSolrXml() throws Exception { /* Ignore */ } finally { cc.shutdown(); - System.clearProperty("solr.security.allow.paths"); } } @@ -657,7 +641,6 @@ public void assertAllowPathFromSolrXmlWin() throws Exception { /* Ignore */ } finally { cc.shutdown(); - System.clearProperty("solr.security.allow.paths"); } } @@ -701,7 +684,6 @@ public void assertAllowPathNormalization() throws Exception { cc.assertPathAllowed(Path.of("/tmp")); }); cc.shutdown(); - System.clearProperty("solr.security.allow.paths"); } @Test @@ -717,7 +699,6 @@ public void assertAllowPathNormalizationWin() throws Exception { cc.assertPathAllowed(Path.of("C:\\tmp")); }); cc.shutdown(); - System.clearProperty("solr.security.allow.paths"); } private static Set ALLOWED_PATHS = Set.of(Path.of("/var/solr")); diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java index 0bf2d7b89ee..d091830fb79 100644 --- a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java +++ b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Writer; -import java.lang.invoke.MethodHandles; import java.nio.charset.StandardCharsets; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -38,15 +37,11 @@ import org.apache.lucene.util.IOUtils; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.SolrException; -import org.junit.After; import org.junit.AssumptionViolatedException; import org.junit.BeforeClass; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class TestCoreDiscovery extends SolrTestCaseJ4 { - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @BeforeClass public static void beforeClass() throws Exception { @@ -141,9 +136,6 @@ private CoreContainer init() { return container; } - @After - public void after() {} - // Test the basic setup, create some dirs with core.properties files in them, but solr.xml has // discoverCores set and ensure that we find all the cores and can load them. @Test @@ -163,7 +155,7 @@ public void testDiscovery() throws Exception { // force loading of core2 by getting it from the CoreContainer try (SolrCore core1 = cc.getCore("core1"); - SolrCore core2 = cc.getCore("core2"); ) { + SolrCore core2 = cc.getCore("core2")) { // Let's assert we did the right thing for implicit properties too. CoreDescriptor desc = core1.getCoreDescriptor(); diff --git a/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java b/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java index 95b4fd7022a..e39c3a8e4f2 100644 --- a/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java +++ b/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java @@ -24,7 +24,6 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.index.LogDocMergePolicyFactory; -import org.junit.AfterClass; import org.junit.BeforeClass; public class TestNRTOpen extends SolrTestCaseJ4 { @@ -43,14 +42,6 @@ public static void beforeClass() throws Exception { assertNRT(1); } - @AfterClass - public static void afterClass() { - // ensure we clean up after ourselves, this will fire before superclass... - System.clearProperty("solr.directoryFactory"); - System.clearProperty("solr.tests.maxBufferedDocs"); - systemClearPropertySolrTestsMergePolicyFactory(); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/core/src/test/org/apache/solr/core/TestReloadAndDeleteDocs.java b/solr/core/src/test/org/apache/solr/core/TestReloadAndDeleteDocs.java index 9081c59ae31..9b653682842 100644 --- a/solr/core/src/test/org/apache/solr/core/TestReloadAndDeleteDocs.java +++ b/solr/core/src/test/org/apache/solr/core/TestReloadAndDeleteDocs.java @@ -24,7 +24,6 @@ public class TestReloadAndDeleteDocs extends SolrTestCaseJ4 { @After public void after() { - System.clearProperty("solr.index.updatelog.enabled"); deleteCore(); } diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrDeletionPolicy2.java b/solr/core/src/test/org/apache/solr/core/TestSolrDeletionPolicy2.java index 74a2301d07b..bd70a1b163f 100644 --- a/solr/core/src/test/org/apache/solr/core/TestSolrDeletionPolicy2.java +++ b/solr/core/src/test/org/apache/solr/core/TestSolrDeletionPolicy2.java @@ -47,8 +47,5 @@ public void testFakeDeletionPolicyClass() { assertEquals( "test.org.apache.solr.core.FakeDeletionPolicy.onCommit", System.getProperty("onCommit")); - - System.clearProperty("onInit"); - System.clearProperty("onCommit"); } } diff --git a/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java b/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java index 5aa8ffec1ed..fa344deb0cc 100644 --- a/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java +++ b/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java @@ -19,24 +19,17 @@ import io.opentelemetry.api.trace.TracerProvider; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.util.tracing.TraceUtils; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class TestTracerConfigurator extends SolrTestCaseJ4 { @BeforeClass - public static void setUpProperties() throws Exception { + public static void setUpProperties() { System.setProperty("otel.service.name", "something"); System.setProperty("solr.otelDefaultConfigurator", "configuratorClassDoesNotExistTest"); } - @AfterClass - public static void clearProperties() throws Exception { - System.clearProperty("solr.otelDefaultConfigurator"); - System.clearProperty("otel.service.name"); - } - @Test public void configuratorClassDoesNotExistTest() { assertTrue(OpenTelemetryConfigurator.shouldAutoConfigOTEL()); @@ -51,10 +44,6 @@ public void configuratorClassDoesNotExistTest() { @Test public void otelDisabledByProperty() { System.setProperty("otel.sdk.disabled", "true"); - try { - assertFalse(OpenTelemetryConfigurator.shouldAutoConfigOTEL()); - } finally { - System.clearProperty("otel.sdk.disabled"); - } + assertFalse(OpenTelemetryConfigurator.shouldAutoConfigOTEL()); } } diff --git a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java index 9b23db09695..6fa70f020e6 100644 --- a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java +++ b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java @@ -44,7 +44,6 @@ import org.apache.solr.core.snapshots.CollectionSnapshotMetaData.CoreSnapshotMetaData; import org.apache.solr.core.snapshots.SolrSnapshotMetaDataManager.SnapshotMetaData; import org.apache.solr.handler.BackupRestoreUtils; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -79,13 +78,6 @@ public static void setupClass() throws Exception { docsSeed = random().nextLong(); } - @AfterClass - public static void teardownClass() { - System.clearProperty("test.build.data"); - System.clearProperty("test.cache.data"); - System.clearProperty("solr.security.allow.paths"); - } - @Test public void testSnapshots() throws Exception { CloudSolrClient solrClient = cluster.getSolrClient(); diff --git a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java index 3ee972c063b..9e0b3ad5497 100644 --- a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java +++ b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java @@ -49,7 +49,6 @@ import org.apache.solr.common.util.NamedList; import org.apache.solr.core.snapshots.SolrSnapshotMetaDataManager.SnapshotMetaData; import org.apache.solr.handler.BackupRestoreUtils; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -77,13 +76,6 @@ public static void setupClass() throws Exception { docsSeed = random().nextLong(); } - @AfterClass - public static void teardownClass() { - System.clearProperty("test.build.data"); - System.clearProperty("test.cache.data"); - System.clearProperty("solr.security.allow.paths"); - } - @Test public void testBackupRestore() throws Exception { CloudSolrClient solrClient = cluster.getSolrClient(); diff --git a/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java b/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java index a4de2935534..230135ea702 100644 --- a/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java +++ b/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java @@ -55,7 +55,6 @@ import org.apache.solr.packagemanager.PackageUtils; import org.apache.solr.util.LogLevel; import org.apache.zookeeper.server.ByteBufferInputStream; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; @@ -71,11 +70,6 @@ public void setup() { System.setProperty("solr.packages.enabled", "true"); } - @After - public void teardown() { - System.clearProperty("solr.packages.enabled"); - } - @Test public void testFileStoreManagement() throws Exception { MiniSolrCloudCluster cluster = diff --git a/solr/core/src/test/org/apache/solr/handler/RequestHandlerMetricsTest.java b/solr/core/src/test/org/apache/solr/handler/RequestHandlerMetricsTest.java index 29b8b36a680..162f58f8912 100644 --- a/solr/core/src/test/org/apache/solr/handler/RequestHandlerMetricsTest.java +++ b/solr/core/src/test/org/apache/solr/handler/RequestHandlerMetricsTest.java @@ -27,7 +27,6 @@ import org.apache.solr.common.SolrInputDocument; import org.apache.solr.core.SolrCore; import org.apache.solr.util.SolrMetricTestUtils; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -47,11 +46,6 @@ public void setUp() throws Exception { cluster.deleteAllCollections(); } - @AfterClass - public static void afterClass() { - System.clearProperty("metricsEnabled"); - } - @Test public void testAggregateNodeLevelMetrics() throws SolrServerException, IOException { String collection1 = "testRequestHandlerMetrics1"; diff --git a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java index f7f0560b6f3..06593f4b3ab 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java +++ b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java @@ -144,7 +144,6 @@ public void setup() throws Exception { @After public void teardown() throws Exception { shutdownCluster(); - System.clearProperty("solr.packages.enabled"); } @SuppressWarnings("unchecked") diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java index 839d832c155..b927b918023 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -265,11 +265,7 @@ public void testUrlAllowList() throws Exception { // Expect the same test to pass now. System.setProperty( TEST_URL_ALLOW_LIST, leaderJetty.getBaseUrl() + "," + followerJetty.getBaseUrl()); - try { - doTestDetails(); - } finally { - System.clearProperty(TEST_URL_ALLOW_LIST); - } + doTestDetails(); } @Test diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java index 9c0d8a3abbb..f573f9ae11b 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerDiskOverFlow.java @@ -115,8 +115,6 @@ public void tearDown() throws Exception { followerClient.close(); followerClient = null; } - System.clearProperty(TEST_URL_ALLOW_LIST); - System.clearProperty("solr.security.allow.urls.enabled"); IndexFetcher.usableDiskSpaceProvider = originalDiskSpaceprovider; IndexFetcher.testWait = originalTestWait; diff --git a/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java b/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java index 1083c5b5e06..6305473b94e 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java +++ b/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java @@ -94,8 +94,6 @@ public void afterTest() throws Exception { if (null != coreClient) { coreClient.close(); } - - System.clearProperty("solr.security.allow.paths"); } @SuppressWarnings("AssertionFailureIgnored") // failure happens inside a thread diff --git a/solr/core/src/test/org/apache/solr/handler/TestStressThreadBackup.java b/solr/core/src/test/org/apache/solr/handler/TestStressThreadBackup.java index 059c9c3cfaa..70db545fced 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestStressThreadBackup.java +++ b/solr/core/src/test/org/apache/solr/handler/TestStressThreadBackup.java @@ -56,7 +56,6 @@ import org.apache.solr.common.util.TimeSource; import org.apache.solr.util.TimeOut; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -80,11 +79,6 @@ public static void beforeClass() { System.setProperty("solr.security.allow.paths", "*"); } - @AfterClass - public static void afterClass() { - System.clearProperty("solr.security.allow.paths"); - } - @Before public void beforeTest() throws Exception { backupDir = createTempDir(getTestClass().getSimpleName() + "_backups"); 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 247459737e6..260953b7bc9 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 @@ -91,9 +91,6 @@ public static void afterClass() throws Exception { int finalRefCount = iwRef.getRefcount(); iwRef.decref(); assertEquals("IW refcount mismatch", initialRefCount, finalRefCount); - systemClearPropertySolrTestsMergePolicyFactory(); - System.clearProperty("solr.tests.maxBufferedDocs"); - System.clearProperty("solr.tests.ramBufferSizeMB"); } @Test diff --git a/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java index dd6a83e2666..9331efa1497 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java @@ -31,7 +31,6 @@ public void testBadElevate() throws Exception { initCore("solrconfig-elevate.xml", "schema12.xml"); assertTrue(hasInitException("QueryElevationComponent")); } finally { - System.clearProperty("elevate.file"); resetExceptionIgnores(); } } diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java index 2d5de7e3bd3..cb8eee206c8 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java @@ -27,7 +27,6 @@ import org.apache.solr.search.stats.ExactStatsCache; import org.apache.solr.search.stats.LRUStatsCache; import org.apache.solr.search.stats.LocalStatsCache; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -63,11 +62,6 @@ public static void beforeClass() { } } - @AfterClass - public static void afterClass() { - System.clearProperty("solr.statsCache"); - } - @Test @ShardsFixed(num = 3) @SuppressWarnings({"unchecked"}) diff --git a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java index 57ff3e91958..8e9e74de9e2 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java @@ -36,7 +36,6 @@ import org.apache.solr.common.SolrInputDocument; import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.security.AllowListUrlChecker; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -70,7 +69,7 @@ private static void appendClusterNodes( } @BeforeClass - public static void setupClusters() throws Exception { + public static void setupClusters() { final String[] clusterIds = new String[] {IMPLICIT_CLUSTER_KEY, EXPLICIT_CLUSTER_KEY}; @@ -124,11 +123,6 @@ public void accept(String clusterId, MiniSolrCloudCluster cluster) { }); } - @AfterClass - public static void afterTests() { - System.clearProperty(EXPLICIT_ALLOW_LIST_PROPERTY + EXPLICIT_CLUSTER_KEY); - } - @Test public void test() throws Exception { assertThat(getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).getHostAllowList(), notNullValue()); diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java index 0f2d98a304e..350bcb81356 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java @@ -24,7 +24,6 @@ import org.apache.solr.search.stats.ExactStatsCache; import org.apache.solr.search.stats.LRUStatsCache; import org.apache.solr.search.stats.LocalStatsCache; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -43,11 +42,6 @@ public static void betterNotBeJ9() { } } - @AfterClass - public static void afterClass() { - System.clearProperty("solr.statsCache"); - } - @Test public void test() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestShardHandlerFactory.java b/solr/core/src/test/org/apache/solr/handler/component/TestShardHandlerFactory.java index 970fa7bb48a..59325e9b55e 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TestShardHandlerFactory.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TestShardHandlerFactory.java @@ -146,7 +146,6 @@ public void getShardsAllowList() { } finally { if (factory != null) factory.close(); if (cc != null) cc.shutdown(); - System.clearProperty(TEST_URL_ALLOW_LIST); } } diff --git a/solr/core/src/test/org/apache/solr/highlight/HighlighterWithoutStoredIdTest.java b/solr/core/src/test/org/apache/solr/highlight/HighlighterWithoutStoredIdTest.java index 20d8cdc84b7..df0a947bd6b 100644 --- a/solr/core/src/test/org/apache/solr/highlight/HighlighterWithoutStoredIdTest.java +++ b/solr/core/src/test/org/apache/solr/highlight/HighlighterWithoutStoredIdTest.java @@ -16,7 +16,6 @@ */ package org.apache.solr.highlight; -import org.junit.AfterClass; import org.junit.BeforeClass; public class HighlighterWithoutStoredIdTest extends HighlighterTest { @@ -26,10 +25,4 @@ public static void beforeClassProps() { System.setProperty("solr.tests.id.stored", "false"); System.setProperty("solr.tests.id.docValues", "true"); } - - @AfterClass - public static void afterClassProps() { - System.clearProperty("solr.tests.id.stored"); - System.clearProperty("solr.tests.id.docValues"); - } } diff --git a/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighter.java b/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighter.java index 67d475a8ebe..fe903ed2475 100644 --- a/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighter.java +++ b/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighter.java @@ -19,7 +19,6 @@ import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.schema.IndexSchema; -import org.junit.AfterClass; import org.junit.BeforeClass; /** Tests for the UnifiedHighlighter Solr plugin * */ @@ -42,15 +41,6 @@ public static void beforeClass() throws Exception { assertFalse(schema.getField("text2").storeOffsetsWithPositions()); } - @AfterClass - public static void afterClass() { - System.clearProperty("filterCache.enabled"); - System.clearProperty("queryResultCache.enabled"); - System.clearProperty("documentCache.enabled"); - System.clearProperty("solr.tests.id.stored"); - System.clearProperty("solr.tests.id.docValues"); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighterWithoutStoredId.java b/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighterWithoutStoredId.java index a0f48615349..6aa12b75c6d 100644 --- a/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighterWithoutStoredId.java +++ b/solr/core/src/test/org/apache/solr/highlight/TestUnifiedSolrHighlighterWithoutStoredId.java @@ -16,7 +16,6 @@ */ package org.apache.solr.highlight; -import org.junit.AfterClass; import org.junit.BeforeClass; /** Tests for the UnifiedHighlighter Solr plugin * */ @@ -27,10 +26,4 @@ public static void beforeClassProps() { System.setProperty("solr.tests.id.stored", "false"); System.setProperty("solr.tests.id.docValues", "true"); } - - @AfterClass - public static void afterClassProps() { - System.clearProperty("solr.tests.id.stored"); - System.clearProperty("solr.tests.id.docValues"); - } } diff --git a/solr/core/src/test/org/apache/solr/pkg/PackageStoreSchemaPluginsTest.java b/solr/core/src/test/org/apache/solr/pkg/PackageStoreSchemaPluginsTest.java index 257501e8052..8faac9b68f9 100644 --- a/solr/core/src/test/org/apache/solr/pkg/PackageStoreSchemaPluginsTest.java +++ b/solr/core/src/test/org/apache/solr/pkg/PackageStoreSchemaPluginsTest.java @@ -79,7 +79,6 @@ public void tearDown() throws Exception { cluster.shutdown(); cluster = null; } - System.clearProperty("solr.packages.enabled"); super.tearDown(); } 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 7c1ade8b189..96d5f86b28a 100644 --- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java +++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java @@ -107,7 +107,6 @@ public void tearDown() throws Exception { if (cluster != null) { cluster.shutdown(); } - System.clearProperty("solr.packages.enabled"); super.tearDown(); } diff --git a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java index c990b09e8b0..4e2d1ba1c68 100644 --- a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java +++ b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java @@ -62,8 +62,6 @@ public void before() throws Exception { @After public void after() throws Exception { solrTestRule.reset(); - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.index.updatelog.enabled"); if (restTestHarness != null) { restTestHarness.close(); diff --git a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymGraphFilterFactory.java b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymGraphFilterFactory.java index 92d67591aa8..4529459389c 100644 --- a/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymGraphFilterFactory.java +++ b/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedSynonymGraphFilterFactory.java @@ -66,8 +66,6 @@ public void after() throws Exception { if (null != tmpSolrHome) { PathUtils.deleteDirectory(tmpSolrHome); } - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.index.updatelog.enabled"); if (restTestHarness != null) { restTestHarness.close(); diff --git a/solr/core/src/test/org/apache/solr/schema/ManagedSchemaRoundRobinCloudTest.java b/solr/core/src/test/org/apache/solr/schema/ManagedSchemaRoundRobinCloudTest.java index 18a891fcc2c..2b770f7f23c 100644 --- a/solr/core/src/test/org/apache/solr/schema/ManagedSchemaRoundRobinCloudTest.java +++ b/solr/core/src/test/org/apache/solr/schema/ManagedSchemaRoundRobinCloudTest.java @@ -27,7 +27,6 @@ import org.apache.solr.client.solrj.request.schema.SchemaRequest; import org.apache.solr.client.solrj.response.schema.SchemaResponse; import org.apache.solr.cloud.SolrCloudTestCase; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -53,11 +52,6 @@ public static void setupCluster() throws Exception { (n, c) -> SolrCloudTestCase.replicasForCollectionAreFullyActive(n, c, NUM_SHARDS, 1)); } - @AfterClass - public static void clearSysProps() { - System.clearProperty("managed.schema.mutable"); - } - @Test public void testAddFieldsRoundRobin() throws Exception { List clients = new ArrayList<>(NUM_SHARDS); diff --git a/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java b/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java index 1f37e4c9c37..b25846244dc 100644 --- a/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java +++ b/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java @@ -297,16 +297,11 @@ public void testVersionBehavior() throws Exception { } public IndexSchema initCoreUsingSchemaVersion(final float ver) throws Exception { - - try { - System.setProperty("solr.schema.test.ver", String.valueOf(ver)); - initCore("solrconfig-basic.xml", "schema-behavior.xml"); - IndexSchema s = h.getCore().getLatestSchema(); - assertEquals( - "Schema version not set correctly", String.valueOf(ver), String.valueOf(s.getVersion())); - return s; - } finally { - System.clearProperty("solr.schema.test.ver"); - } + System.setProperty("solr.schema.test.ver", String.valueOf(ver)); + initCore("solrconfig-basic.xml", "schema-behavior.xml"); + IndexSchema s = h.getCore().getLatestSchema(); + assertEquals( + "Schema version not set correctly", String.valueOf(ver), String.valueOf(s.getVersion())); + return s; } } diff --git a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java index 3d3c84d6cda..cae956218cf 100644 --- a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java +++ b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java @@ -65,8 +65,6 @@ public void initManagedSchemaCore() throws Exception { @After public void afterClass() { deleteCore(); - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.index.updatelog.enabled"); } static final String INDEXED_COORDINATES = "25,82"; diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java index 7ad3ad1513f..4351b453dbb 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java +++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java @@ -87,8 +87,6 @@ public void initManagedSchemaCore() throws Exception { @After public void afterClass() { deleteCore(); - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.index.updatelog.enabled"); } public void testUpgrade() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java index 63af94e33d1..2168c55c340 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java +++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaAPI.java @@ -30,7 +30,6 @@ import org.apache.solr.client.solrj.response.schema.SchemaResponse; import org.apache.solr.cloud.SolrCloudTestCase; import org.apache.solr.common.SolrInputDocument; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -48,11 +47,6 @@ public static void createCluster() throws Exception { .configure(); } - @AfterClass - public static void tearDownClass() { - System.clearProperty("managed.schema.mutable"); - } - @Test public void test() throws Exception { String collection = "testschemaapi"; diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaWithMultipleAdd.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaWithMultipleAdd.java index d57bd5cc2fb..235e69b08fc 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaWithMultipleAdd.java +++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaWithMultipleAdd.java @@ -30,7 +30,6 @@ import org.apache.solr.client.solrj.response.schema.SchemaResponse; import org.apache.solr.cloud.SolrCloudTestCase; import org.apache.solr.common.SolrInputDocument; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -52,12 +51,6 @@ public static void createClusterAndInitSysProperties() throws Exception { .configure(); } - @AfterClass - public static void afterRestartWhileUpdatingTest() { - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.autoSoftCommit.maxTime"); - } - @Test public void test() throws Exception { String collection = "testschemaapi"; diff --git a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java index 59c40f16edc..f227627497e 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java +++ b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java @@ -122,8 +122,6 @@ public void initManagedSchemaCore() throws Exception { public void afterTest() { clearIndex(); deleteCore(); - System.clearProperty("managed.schema.mutable"); - System.clearProperty("solr.index.updatelog.enabled"); } public String getCoreName() { diff --git a/solr/core/src/test/org/apache/solr/search/ComponentStageLimitsTest.java b/solr/core/src/test/org/apache/solr/search/ComponentStageLimitsTest.java index 5fce638c7b7..7d1ab7939a1 100644 --- a/solr/core/src/test/org/apache/solr/search/ComponentStageLimitsTest.java +++ b/solr/core/src/test/org/apache/solr/search/ComponentStageLimitsTest.java @@ -90,7 +90,6 @@ public static void setupClass() throws Exception { @AfterClass public static void tearDownClass() { TestInjection.cpuTimerDelayInjectedNS = null; - systemClearPropertySolrTestsMergePolicyFactory(); } @Test diff --git a/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java b/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java index ffb5a0708d3..9c14cb2bf46 100644 --- a/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java +++ b/solr/core/src/test/org/apache/solr/search/LargeFieldTest.java @@ -27,7 +27,6 @@ import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.util.XML; import org.apache.solr.schema.IndexSchema; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -77,12 +76,6 @@ public static void initManagedSchemaCore() throws Exception { h.getCore().setLatestSchema(schema); } - @AfterClass - public static void afterClass() { - System.clearProperty("documentCache.enabled"); - System.clearProperty("enableLazyFieldLoading"); - } - @Test public void test() throws Exception { // add just one document (docid 0) diff --git a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java index 740e385214c..2afe765197a 100644 --- a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java +++ b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java @@ -87,7 +87,6 @@ public static void setupClass() throws Exception { @AfterClass public static void tearDownClass() { TestInjection.cpuTimerDelayInjectedNS = null; - systemClearPropertySolrTestsMergePolicyFactory(); } @Test diff --git a/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java b/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java index 7130e310e40..48016588de3 100644 --- a/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java +++ b/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java @@ -52,12 +52,6 @@ protected void before() throws Throwable { systemSetPropertySolrTestsMergePolicyFactory(NoMergePolicyFactory.class.getName()); startSolr(LuceneTestCase.createTempDir()); } - - @Override - protected void after() { - systemClearPropertySolrTestsMergePolicyFactory(); - super.after(); - } }; private static String fieldConfig(String fieldName, boolean multivalued) { diff --git a/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java b/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java index 857aac9800f..1fc9b1819cd 100644 --- a/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java +++ b/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java @@ -47,7 +47,6 @@ import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.schema.SchemaField; import org.apache.solr.util.plugin.SolrCoreAware; -import org.junit.AfterClass; import org.junit.BeforeClass; public class TestIndexSearcher extends SolrTestCaseJ4 { @@ -62,11 +61,6 @@ public static void beforeClass() throws Exception { initCore("solrconfig.xml", "schema.xml"); } - @AfterClass - public static void afterClass() { - systemClearPropertySolrTestsMergePolicyFactory(); - } - @Override public void setUp() throws Exception { System.getProperties().remove("tests.solr.useColdSearcher"); diff --git a/solr/core/src/test/org/apache/solr/search/TestMainQueryCaching.java b/solr/core/src/test/org/apache/solr/search/TestMainQueryCaching.java index afc8807a6e6..4df4610a501 100644 --- a/solr/core/src/test/org/apache/solr/search/TestMainQueryCaching.java +++ b/solr/core/src/test/org/apache/solr/search/TestMainQueryCaching.java @@ -58,12 +58,10 @@ public static void beforeClass() throws Exception { @AfterClass public static void afterClass() { if (RESTORE_UFFSQ_PROP == null) { - System.clearProperty(TEST_UFFSQ_PROPNAME); } else { System.setProperty(TEST_UFFSQ_PROPNAME, RESTORE_UFFSQ_PROP); } if (RESTORE_QRC_WINDOW_SIZE_PROP == null) { - System.clearProperty(TEST_QRC_WINDOW_SIZE_PROPNAME); } else { System.setProperty(TEST_QRC_WINDOW_SIZE_PROPNAME, RESTORE_QRC_WINDOW_SIZE_PROP); } diff --git a/solr/core/src/test/org/apache/solr/search/TestMemAllowedLimit.java b/solr/core/src/test/org/apache/solr/search/TestMemAllowedLimit.java index 533054dca0f..e4134ba145b 100644 --- a/solr/core/src/test/org/apache/solr/search/TestMemAllowedLimit.java +++ b/solr/core/src/test/org/apache/solr/search/TestMemAllowedLimit.java @@ -90,7 +90,6 @@ public static void setup() throws Exception { @AfterClass public static void tearDownClass() { TestInjection.cpuTimerDelayInjectedNS = null; - systemClearPropertySolrTestsMergePolicyFactory(); } @Test diff --git a/solr/core/src/test/org/apache/solr/search/TestRecovery.java b/solr/core/src/test/org/apache/solr/search/TestRecovery.java index 928e8dd73c7..e20a2d8cf27 100644 --- a/solr/core/src/test/org/apache/solr/search/TestRecovery.java +++ b/solr/core/src/test/org/apache/solr/search/TestRecovery.java @@ -69,11 +69,8 @@ public class TestRecovery extends SolrTestCaseJ4 { private static int timeout = 60; // TODO: fix this test to not require FSDirectory - static String savedFactory; - @Before public void beforeTest() throws Exception { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); initCore("solrconfig-tlog.xml", "schema15.xml"); @@ -88,12 +85,6 @@ public void beforeTest() throws Exception { @After public void afterTest() { TestInjection.reset(); // do after every test, don't wait for AfterClass - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - deleteCore(); } diff --git a/solr/core/src/test/org/apache/solr/search/stats/TestBaseStatsCache.java b/solr/core/src/test/org/apache/solr/search/stats/TestBaseStatsCache.java index 9c7cf4e1d07..23a5f31ba9c 100644 --- a/solr/core/src/test/org/apache/solr/search/stats/TestBaseStatsCache.java +++ b/solr/core/src/test/org/apache/solr/search/stats/TestBaseStatsCache.java @@ -36,7 +36,6 @@ public void distribSetUp() throws Exception { @Override public void distribTearDown() throws Exception { super.distribTearDown(); - System.clearProperty("solr.statsCache"); } // in this case, as the number of shards increases, per-shard scores should diff --git a/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java b/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java index 80e95607f56..d7dd6e3add1 100644 --- a/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java +++ b/solr/core/src/test/org/apache/solr/search/stats/TestDefaultStatsCache.java @@ -39,7 +39,6 @@ public void distribSetUp() throws Exception { @Override public void distribTearDown() throws Exception { super.distribTearDown(); - System.clearProperty("solr.statsCache"); } @Test diff --git a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java index 9a7e758a6a5..4f63b16f52f 100644 --- a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java +++ b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java @@ -62,7 +62,6 @@ public void setUp() throws Exception { @Override public void tearDown() throws Exception { solrCluster.shutdown(); - System.clearProperty("solr.statsCache"); super.tearDown(); } diff --git a/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java b/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java index 1b589cf5687..dd6f96c4f71 100644 --- a/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java +++ b/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java @@ -29,7 +29,6 @@ import org.apache.solr.handler.component.ResponseBuilder; import org.apache.solr.handler.component.SearchComponent; import org.apache.solr.util.SolrJettyTestRule; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; @@ -66,11 +65,6 @@ public static void setupSolrHome() throws Exception { solrTestRule.newCollection().withConfigSet(configSet).create(); } - @AfterClass - public static void cleanup() throws Exception { - System.clearProperty("solr.hideStackTrace"); - } - @Test public void testHideStackTrace() throws Exception { // Normal stack: @@ -143,8 +137,7 @@ public void testHideStackTrace() throws Exception { // } // } - final String url = - solrTestRule.getBaseUrl().toString() + "/collection1/withError?q=*:*&wt=json"; + final String url = solrTestRule.getBaseUrl() + "/collection1/withError?q=*:*&wt=json"; final HttpGet get = new HttpGet(url); var client = HttpClientUtil.createClient(null); try (CloseableHttpResponse response = client.execute(get)) { diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java index 5646d10af63..78984412cab 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java @@ -19,7 +19,6 @@ import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.params.SpellingParams; import org.apache.solr.common.util.NamedList; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -28,24 +27,12 @@ public class SuggesterTest extends SolrTestCaseJ4 { protected String requestUri = "/suggest"; // TODO: fix this test to not require FSDirectory - static String savedFactory; - @BeforeClass public static void beforeClass() throws Exception { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); initCore("solrconfig-spellchecker.xml", "schema-spellchecker.xml"); } - @AfterClass - public static void afterClass() { - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - } - public static void addDocs() { assertU( adoc( diff --git a/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java b/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java index ee774416e48..7449586b446 100644 --- a/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java @@ -40,7 +40,6 @@ import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.util.LogLevel; import org.apache.solr.util.SolrMetricTestUtils; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -52,11 +51,8 @@ public class DirectUpdateHandlerTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - static String savedFactory; - @BeforeClass public static void beforeClass() throws Exception { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); System.setProperty( "solr.index.updatelog.enabled", "false"); // schema12 doesn't support _version_ @@ -64,16 +60,6 @@ public static void beforeClass() throws Exception { initCore("solrconfig.xml", "schema12.xml"); } - @AfterClass - public static void afterClass() { - systemClearPropertySolrTestsMergePolicyFactory(); - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - } - @Override @Before public void setUp() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java index 749283cd4e7..5f90cd00a98 100644 --- a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java +++ b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java @@ -99,7 +99,6 @@ public void tearDown() throws Exception { monitor.clear(); } super.tearDown(); - System.clearProperty("solr.ulog"); deleteCore(); } diff --git a/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java b/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java index bfacf1c78d3..a237ac49c97 100644 --- a/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java +++ b/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java @@ -56,7 +56,6 @@ import org.apache.solr.update.processor.DistributedUpdateProcessor.LeaderRequestReplicationTracker; import org.apache.solr.update.processor.DistributedUpdateProcessor.RollupRequestReplicationTracker; import org.apache.solr.util.TestInjection; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -79,12 +78,6 @@ public static void beforeClass() { System.setProperty("solr.cloud.client.pollQueueTime", "2000"); } - @AfterClass - public static void afterClass() { - systemClearPropertySolrTestsMergePolicyFactory(); - System.clearProperty("solr.cloud.client.pollQueueTime"); - } - private UpdateShardHandler updateShardHandler; public SolrCmdDistributorTest() { diff --git a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java index 79f936ddd2f..78d45b2c49e 100644 --- a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java +++ b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java @@ -38,7 +38,6 @@ import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchemaFactory; import org.apache.solr.util.RandomForceMergePolicy; -import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; @@ -75,14 +74,6 @@ public static void beforeClass() throws Exception { initCore(solrConfigFileName, schemaFileName); } - @Override - @After - public void tearDown() throws Exception { - System.clearProperty("mergePolicySort"); - System.clearProperty("solr.tests.maxCommitMergeWait"); - super.tearDown(); - } - private final Path instanceDir = TEST_PATH().resolve("collection1"); @Test @@ -103,8 +94,7 @@ public void testFailingSolrIndexConfigCreation() throws Exception { @Test public void testTieredMPSolrIndexConfigCreation() throws Exception { - String solrConfigFileName = solrConfigFileNameTieredMergePolicyFactory; - SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileName); + SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileNameTieredMergePolicyFactory); SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null); IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig); @@ -127,8 +117,7 @@ public void testTieredMPSolrIndexConfigCreation() throws Exception { @Test public void testConcurrentMergeSchedularSolrIndexConfigCreation() throws Exception { - String solrConfigFileName = solrConfigFileNameConnMSPolicyFactory; - SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileName); + SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileNameConnMSPolicyFactory); SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null); IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig); @@ -177,7 +166,6 @@ public void testSortingMPSolrIndexConfigCreation() throws Exception { } public void testMergeOnFlushMPSolrIndexConfigCreation() throws Exception { - final SortField sortField1 = new SortField("timestamp_i_dvo", SortField.Type.INT, true); final SortField sortField2 = new SortField("id", SortField.Type.STRING, false); sortField2.setMissingValue(SortField.STRING_LAST); @@ -250,10 +238,10 @@ public void testMergedSegmentWarmerIndexConfigCreation() throws Exception { } public void testToMap() throws Exception { - final String solrConfigFileNameWarmer = solrConfigFileNameWarmerRandomMergePolicyFactory; - final String solrConfigFileNameTMP = solrConfigFileNameTieredMergePolicyFactory; final String solrConfigFileName = - (random().nextBoolean() ? solrConfigFileNameWarmer : solrConfigFileNameTMP); + (random().nextBoolean() + ? solrConfigFileNameWarmerRandomMergePolicyFactory + : solrConfigFileNameTieredMergePolicyFactory); SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileName); SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null); assertNotNull(solrIndexConfig); diff --git a/solr/core/src/test/org/apache/solr/update/TestAtomicUpdateErrorCases.java b/solr/core/src/test/org/apache/solr/update/TestAtomicUpdateErrorCases.java index fc53b7cc265..a92220171d8 100644 --- a/solr/core/src/test/org/apache/solr/update/TestAtomicUpdateErrorCases.java +++ b/solr/core/src/test/org/apache/solr/update/TestAtomicUpdateErrorCases.java @@ -48,7 +48,6 @@ public void testUpdateNoTLog() throws Exception { assertTrue(ex.getMessage().contains("unless is configured")); resetExceptionIgnores(); } finally { - System.clearProperty("solr.index.updatelog.enabled"); deleteCore(); } } diff --git a/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java b/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java index 6163e3962a7..d4e360f9f7e 100644 --- a/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java +++ b/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java @@ -24,7 +24,6 @@ import org.apache.solr.common.util.StrUtils; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.util.RTimer; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,25 +38,14 @@ public class TestIndexingPerformance extends SolrTestCaseJ4 { // TODO: fix this test to not require FSDirectory - static String savedFactory; @BeforeClass public static void beforeClass() throws Exception { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); initCore("solrconfig_perf.xml", "schema12.xml"); } - @AfterClass - public static void afterClass() { - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - } - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public void testIndexingPerf() throws IOException { diff --git a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java index e5bf79c4c41..341f73fdabd 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java @@ -59,7 +59,6 @@ public static void beforeClass() throws Exception { @AfterClass public static void afterClass() { ExecutorUtil.shutdownAndAwaitTermination(executor); - System.clearProperty("solr.index.updatelog.enabled"); } @Test diff --git a/solr/core/src/test/org/apache/solr/util/TestCborDataFormat.java b/solr/core/src/test/org/apache/solr/util/TestCborDataFormat.java index ae18ef88132..056e9536529 100644 --- a/solr/core/src/test/org/apache/solr/util/TestCborDataFormat.java +++ b/solr/core/src/test/org/apache/solr/util/TestCborDataFormat.java @@ -104,7 +104,6 @@ public void testRoundTrip() throws Exception { QueryResponse result = new QueryRequest(q).process(client, testCollection); assertEquals(6, result.getResults().size()); } finally { - System.clearProperty("managed.schema.mutable"); cluster.shutdown(); } } diff --git a/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java b/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java index 52998058738..23381e9de01 100644 --- a/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java +++ b/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java @@ -165,40 +165,35 @@ public void testGlobalCBsCanBeParsedFromSystemProperties() { props.setProperty("solr.circuitbreaker.update.cpu.warnonly", "true"); System.setProperties(props); - try { - final var parsedBreakers = - CircuitBreakerRegistry.parseCircuitBreakersFromProperties(h.getCoreContainer()).stream() - .sorted(Comparator.comparing(breaker -> breaker.toString())) - .collect(Collectors.toList()); - - assertEquals(3, parsedBreakers.size()); - - assertTrue( - "Expected CPUCircuitBreaker, but got " + parsedBreakers.get(0).getClass().getName(), - parsedBreakers.get(0) instanceof CPUCircuitBreaker); - final var cpuBreaker = (CPUCircuitBreaker) parsedBreakers.get(0); - assertEquals(56.0, cpuBreaker.getCpuUsageThreshold(), 0.1); - assertEquals(true, cpuBreaker.isWarnOnly()); - assertEquals(Set.of(SolrRequest.SolrRequestType.UPDATE), cpuBreaker.getRequestTypes()); - - assertTrue( - "Expected LoadAverageCircuitBreaker, but got " - + parsedBreakers.get(1).getClass().getName(), - parsedBreakers.get(1) instanceof LoadAverageCircuitBreaker); - final var loadAvgBreaker = (LoadAverageCircuitBreaker) parsedBreakers.get(1); - assertEquals(3.4, loadAvgBreaker.getLoadAverageThreshold(), 0.1); - assertEquals(false, loadAvgBreaker.isWarnOnly()); - assertEquals(Set.of(SolrRequest.SolrRequestType.UPDATE), loadAvgBreaker.getRequestTypes()); - - assertTrue( - "Expected MemoryCircuitBreaker, but got " + parsedBreakers.get(2).getClass().getName(), - parsedBreakers.get(2) instanceof MemoryCircuitBreaker); - final var memBreaker = (MemoryCircuitBreaker) parsedBreakers.get(2); - assertEquals(false, memBreaker.isWarnOnly()); - assertEquals(Set.of(SolrRequest.SolrRequestType.QUERY), memBreaker.getRequestTypes()); - } finally { - props.keySet().stream().forEach(k -> System.clearProperty((String) k)); - } + final var parsedBreakers = + CircuitBreakerRegistry.parseCircuitBreakersFromProperties(h.getCoreContainer()).stream() + .sorted(Comparator.comparing(breaker -> breaker.toString())) + .collect(Collectors.toList()); + + assertEquals(3, parsedBreakers.size()); + + assertTrue( + "Expected CPUCircuitBreaker, but got " + parsedBreakers.get(0).getClass().getName(), + parsedBreakers.get(0) instanceof CPUCircuitBreaker); + final var cpuBreaker = (CPUCircuitBreaker) parsedBreakers.get(0); + assertEquals(56.0, cpuBreaker.getCpuUsageThreshold(), 0.1); + assertEquals(true, cpuBreaker.isWarnOnly()); + assertEquals(Set.of(SolrRequest.SolrRequestType.UPDATE), cpuBreaker.getRequestTypes()); + + assertTrue( + "Expected LoadAverageCircuitBreaker, but got " + parsedBreakers.get(1).getClass().getName(), + parsedBreakers.get(1) instanceof LoadAverageCircuitBreaker); + final var loadAvgBreaker = (LoadAverageCircuitBreaker) parsedBreakers.get(1); + assertEquals(3.4, loadAvgBreaker.getLoadAverageThreshold(), 0.1); + assertEquals(false, loadAvgBreaker.isWarnOnly()); + assertEquals(Set.of(SolrRequest.SolrRequestType.UPDATE), loadAvgBreaker.getRequestTypes()); + + assertTrue( + "Expected MemoryCircuitBreaker, but got " + parsedBreakers.get(2).getClass().getName(), + parsedBreakers.get(2) instanceof MemoryCircuitBreaker); + final var memBreaker = (MemoryCircuitBreaker) parsedBreakers.get(2); + assertEquals(false, memBreaker.isWarnOnly()); + assertEquals(Set.of(SolrRequest.SolrRequestType.QUERY), memBreaker.getRequestTypes()); } @SuppressWarnings("resource") @@ -212,7 +207,6 @@ public void testCBAlwaysTripsInvalidErrorCodeSysProp() { SolrException ex = expectThrows(SolrException.class, () -> new MockCircuitBreaker(true)); assertTrue(ex.getMessage().contains("Invalid error code")); - System.clearProperty(CircuitBreaker.SYSPROP_SOLR_CIRCUITBREAKER_ERRORCODE); }); } } diff --git a/solr/core/src/test/org/apache/solr/util/TestGlobalCircuitBreaker.java b/solr/core/src/test/org/apache/solr/util/TestGlobalCircuitBreaker.java index a50e2162856..db1a3b4380d 100644 --- a/solr/core/src/test/org/apache/solr/util/TestGlobalCircuitBreaker.java +++ b/solr/core/src/test/org/apache/solr/util/TestGlobalCircuitBreaker.java @@ -42,7 +42,6 @@ public static void setUpClass() throws Exception { @AfterClass public static void afterClass() throws Exception { - System.clearProperty(CircuitBreakerRegistry.SYSPROP_UPDATE_LOADAVG); // Deregister the global breaker to not interfere with other tests CircuitBreakerRegistry.deregisterGlobal(); } diff --git a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java index f1a0250b1db..fc960908bd0 100644 --- a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java +++ b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java @@ -27,12 +27,6 @@ public class TestSystemIdResolver extends SolrTestCaseJ4 { - @Override - public void tearDown() throws Exception { - System.clearProperty(SolrResourceLoader.SOLR_RESOURCELOADING_RESTRICTED_ENABLED_PARAM); - super.tearDown(); - } - private void assertEntityResolving( SystemIdResolver resolver, String expectedSystemId, String base, String systemId) throws Exception { diff --git a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java index 920bf4579f1..56272ddf44a 100644 --- a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java +++ b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java @@ -39,7 +39,6 @@ import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.response.SolrQueryResponse; import org.apache.solr.util.SolrKafkaTestsIgnoredThreadsFilter; -import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -60,7 +59,6 @@ public class MirroringCollectionsHandlerTest extends SolrTestCaseJ4 { private final ZkController zkController = Mockito.mock(ZkController.class); private final SolrZkClient solrZkClient = Mockito.mock(SolrZkClient.class); - @SuppressWarnings("unchecked") private ArgumentCaptor> captor; @BeforeClass @@ -85,14 +83,6 @@ public void setUp() throws Exception { System.setProperty(KafkaCrossDcConf.TOPIC_NAME, "foo"); } - @After - public void teardown() throws Exception { - System.clearProperty(KafkaCrossDcConf.MIRROR_COLLECTIONS); - System.clearProperty(KafkaCrossDcConf.BOOTSTRAP_SERVERS); - System.clearProperty(KafkaCrossDcConf.TOPIC_NAME); - super.tearDown(); - } - @Test public void testAllCollections() throws Exception { for (String collection : List.of("test1", "test2", "test3")) { diff --git a/solr/modules/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTikaServerTest.java b/solr/modules/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTikaServerTest.java index d223960a790..2c0a1684ec8 100644 --- a/solr/modules/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTikaServerTest.java +++ b/solr/modules/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTikaServerTest.java @@ -73,9 +73,6 @@ public static void afterClassTika() { tika = null; } } - System.clearProperty("solr.test.tikaserver.url"); - System.clearProperty("solr.test.extraction.backend"); - System.clearProperty("solr.test.tikaserver.metadata.compatibility"); } @Test diff --git a/solr/modules/language-models/src/test/org/apache/solr/languagemodels/TestLanguageModelBase.java b/solr/modules/language-models/src/test/org/apache/solr/languagemodels/TestLanguageModelBase.java index ea02c0f0e8c..aaf3143e351 100644 --- a/solr/modules/language-models/src/test/org/apache/solr/languagemodels/TestLanguageModelBase.java +++ b/solr/modules/language-models/src/test/org/apache/solr/languagemodels/TestLanguageModelBase.java @@ -87,7 +87,6 @@ protected static void afterTest() throws Exception { PathUtils.deleteDirectory(tmpSolrHome); tmpSolrHome = null; } - System.clearProperty("managed.schema.mutable"); } public static void loadModel(String fileName, String status) throws Exception { diff --git a/solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java b/solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java index 7a26562adae..ed3a0c492c2 100644 --- a/solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java +++ b/solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java @@ -472,6 +472,5 @@ public static void after() throws Exception { PathUtils.deleteDirectory(tmpSolrHome); tmpSolrHome = null; } - System.clearProperty("managed.schema.mutable"); } } diff --git a/solr/modules/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java b/solr/modules/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java index 30037e3bc2d..c21668fb1b5 100644 --- a/solr/modules/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java +++ b/solr/modules/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java @@ -104,10 +104,6 @@ protected static void chooseDefaultFeatureFormat() throws Exception { } } - protected static void unchooseDefaultFeatureFormat() { - System.clearProperty(SYSTEM_PROPERTY_SOLR_LTR_TRANSFORMER_FV_DEFAULTFORMAT); - } - protected static void setuptest(boolean bulkIndex) throws Exception { chooseDefaultFeatureFormat(); setuptest("solrconfig-ltr.xml", "schema.xml"); @@ -203,9 +199,6 @@ protected static void aftertest() throws Exception { PathUtils.deleteDirectory(tmpSolrHome); tmpSolrHome = null; } - System.clearProperty("managed.schema.mutable"); - // System.clearProperty("solr.index.updatelog.enabled"); - unchooseDefaultFeatureFormat(); } public static void makeRestTestHarnessNull() { diff --git a/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/CustomTestOtelTracerConfigurator.java b/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/CustomTestOtelTracerConfigurator.java index e208d6d0034..c9501edd810 100644 --- a/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/CustomTestOtelTracerConfigurator.java +++ b/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/CustomTestOtelTracerConfigurator.java @@ -97,7 +97,6 @@ public static synchronized void resetForTest() { exporter.close(); exporter = null; } - System.clearProperty("otel.traces.exporter"); } } } diff --git a/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/OtelTracerConfiguratorTest.java b/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/OtelTracerConfiguratorTest.java index 18e99f6e6be..a1cfc7bf10d 100644 --- a/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/OtelTracerConfiguratorTest.java +++ b/solr/modules/opentelemetry/src/test/org/apache/solr/opentelemetry/OtelTracerConfiguratorTest.java @@ -21,7 +21,6 @@ import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.util.EnvUtils; import org.apache.solr.common.util.NamedList; -import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -44,17 +43,6 @@ public void setUp() throws Exception { instance = new OtelTracerConfigurator(currentEnv); } - @Override - @After - public void tearDown() throws Exception { - super.tearDown(); - System.clearProperty("otelnothere"); - System.clearProperty("otel.k1"); - System.clearProperty("otel.k3"); - System.clearProperty("host"); - System.clearProperty("otel.resource.attributes"); - } - @Test public void testGetCurrentOtelConfig() { Map expected = diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java index e7ff5e40891..bbf63842d62 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java @@ -42,8 +42,6 @@ public abstract class MergeIndexesExampleTestBase extends SolrTestCaseJ4 { protected CoreContainer cores; - private String saveProp; - private Path dataDir1; private Path dataDir2; private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -60,7 +58,6 @@ protected void setupCoreContainer() { @Override public void setUp() throws Exception { - saveProp = System.getProperty("solr.directoryFactory"); System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory"); super.setUp(); Path dataDir1 = createTempDir(); @@ -84,9 +81,6 @@ public void tearDown() throws Exception { super.tearDown(); cores.shutdown(); - - if (saveProp == null) System.clearProperty("solr.directoryFactory"); - else System.setProperty("solr.directoryFactory", saveProp); } protected abstract SolrClient getSolrCore0(); @@ -165,7 +159,7 @@ public void testMergeIndexesByCoreName() throws Exception { assertEquals(1, getSolrCore0().query(new SolrQuery("id:BBB")).getResults().size()); } - public void testMergeMultipleRequest() throws Exception { + public void testMergeMultipleRequest() { CoreAdminRequest.MergeIndexes req = new CoreAdminRequest.MergeIndexes(); req.setCoreName("core0"); req.setIndexDirs(Arrays.asList("/path/1", "/path/2")); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java index 222a17018a6..1f4d0ce1e84 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java @@ -40,7 +40,6 @@ import org.apache.solr.embedded.JettyConfig; import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.util.TimeOut; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,25 +57,12 @@ public class TestLBHttpSolrClient extends SolrTestCaseJ4 { CloseableHttpClient httpClient; // TODO: fix this test to not require FSDirectory - static String savedFactory; - @BeforeClass public static void beforeClass() { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong())); } - @AfterClass - public static void afterClass() { - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - System.clearProperty("tests.shardhandler.randomSeed"); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java index 6a1fac16cbd..fbb634d61dd 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java @@ -80,10 +80,6 @@ public void setUp() throws Exception { public void tearDown() throws Exception { if (cores != null) cores.shutdown(); - System.clearProperty("dataDir1"); - System.clearProperty("dataDir2"); - System.clearProperty("tests.shardhandler.randomSeed"); - deleteAdditionalFiles(); super.tearDown(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java index fd062f3d632..f2f4e5efc19 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java @@ -80,9 +80,6 @@ public void tearDown() throws Exception { server.stop(); } catch (Exception ex) { } - System.clearProperty("tests.shardhandler.randomSeed"); - System.clearProperty("solr.data.dir"); - System.clearProperty("solr.tests.doContainerStreamCloseAssert"); super.tearDown(); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java index de3860eb524..5c7a353956b 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java @@ -27,13 +27,6 @@ */ public class MergeIndexesEmbeddedTest extends MergeIndexesExampleTestBase { - @Override - public void setUp() throws Exception { - // TODO: fix this test to use MockDirectoryFactory - System.clearProperty("solr.directoryFactory"); - super.setUp(); - } - @Override protected SolrClient getSolrCore0() { return new EmbeddedSolrServer(cores, "core0"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java index c1deeeee1ca..d9f6680c70b 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java @@ -40,7 +40,6 @@ import org.apache.solr.client.solrj.RemoteSolrException; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.jetty.HttpJettySolrClient; import org.apache.solr.client.solrj.request.QueryRequest; import org.apache.solr.client.solrj.request.SolrQuery; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -96,8 +95,6 @@ public static void beforeTest() throws Exception { @Override public void tearDown() throws Exception { - System.clearProperty("solr.security.auth.basicauth.credentials"); - System.clearProperty(HttpJettySolrClient.CLIENT_CUSTOMIZER_SYSPROP); DebugServlet.clear(); super.tearDown(); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java index 2196f69675e..79c24dfd62d 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LB2SolrClientTest.java @@ -40,7 +40,6 @@ import org.apache.solr.embedded.JettySolrRunner; import org.apache.solr.util.LogLevel; import org.apache.solr.util.LogListener; -import org.junit.AfterClass; import org.junit.BeforeClass; /** @@ -54,25 +53,13 @@ public class LB2SolrClientTest extends SolrTestCaseJ4 { SolrInstance[] solr = new SolrInstance[3]; // TODO: fix this test to not require FSDirectory - static String savedFactory; @BeforeClass public static void beforeClass() { - savedFactory = System.getProperty("solr.DirectoryFactory"); System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory"); System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong())); } - @AfterClass - public static void afterClass() { - if (savedFactory == null) { - System.clearProperty("solr.directoryFactory"); - } else { - System.setProperty("solr.directoryFactory", savedFactory); - } - System.clearProperty("tests.shardhandler.randomSeed"); - } - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientTest.java index 11171989a5c..7d4ffa9242e 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientTest.java @@ -454,8 +454,6 @@ public void testGetDefaultSslContextFactory() { assertEquals("HTTPS", sslContextFactory.getEndpointIdentificationAlgorithm()); assertEquals("foo", sslContextFactory.getKeyStoreType()); assertEquals("bar", sslContextFactory.getTrustStoreType()); - System.clearProperty("javax.net.ssl.keyStoreType"); - System.clearProperty("javax.net.ssl.trustStoreType"); System.setProperty("solr.ssl.check.peer.name.enabled", "true"); System.setProperty("javax.net.ssl.keyStoreType", "foo"); @@ -464,9 +462,6 @@ public void testGetDefaultSslContextFactory() { assertEquals("HTTPS", sslContextFactory2.getEndpointIdentificationAlgorithm()); assertEquals("foo", sslContextFactory2.getKeyStoreType()); assertEquals("bar", sslContextFactory2.getTrustStoreType()); - System.clearProperty("solr.ssl.check.peer.name.enabled"); - System.clearProperty("javax.net.ssl.keyStoreType"); - System.clearProperty("javax.net.ssl.trustStoreType"); System.setProperty("solr.ssl.check.peer.name.enabled", "false"); System.setProperty("javax.net.ssl.keyStoreType", "foo"); @@ -475,9 +470,6 @@ public void testGetDefaultSslContextFactory() { assertNull(sslContextFactory3.getEndpointIdentificationAlgorithm()); assertEquals("foo", sslContextFactory3.getKeyStoreType()); assertEquals("bar", sslContextFactory3.getTrustStoreType()); - System.clearProperty("solr.ssl.check.peer.name.enabled"); - System.clearProperty("javax.net.ssl.keyStoreType"); - System.clearProperty("javax.net.ssl.trustStoreType"); } protected void expectThrowsAndMessage( @@ -533,8 +525,6 @@ public void testSetCredentialsWithSysProps() { "Basic " + Base64.getEncoder().encodeToString("foo:bar".getBytes(StandardCharsets.UTF_8)), authorizationHeader); } finally { - System.clearProperty(PreemptiveBasicAuthClientCustomizer.SYS_PROP_BASIC_AUTH_CREDENTIALS); - System.clearProperty(HttpJettySolrClient.CLIENT_CUSTOMIZER_SYSPROP); PreemptiveBasicAuthClientCustomizer.setDefaultSolrParams(SolrParams.of()); } } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java index 98d853c787d..56d78220b57 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java @@ -57,8 +57,7 @@ private static void assertValidSchemaResponse(SolrResponseBase schemaResponse) { assertEquals( "Response contained errors: " + schemaResponse.toString(), 0, schemaResponse.getStatus()); assertNull( - "Response contained errors: " + schemaResponse.toString(), - schemaResponse.getResponse().get("errors")); + "Response contained errors: " + schemaResponse, schemaResponse.getResponse().get("errors")); } private static void assertFailedSchemaResponse( @@ -461,7 +460,7 @@ public void testDeleteDynamicFieldAccuracy() throws Exception { } @Test - public void deletingADynamicFieldThatDoesntExistInTheSchemaShouldFail() throws Exception { + public void deletingADynamicFieldThatDoesntExistInTheSchemaShouldFail() { String dynamicFieldName = "*_notexists"; SchemaRequest.DeleteDynamicField deleteDynamicFieldRequest = new SchemaRequest.DeleteDynamicField(dynamicFieldName); @@ -723,7 +722,7 @@ public void testDeleteFieldTypeAccuracy() throws Exception { } @Test - public void deletingAFieldTypeThatDoesntExistInTheSchemaShouldFail() throws Exception { + public void deletingAFieldTypeThatDoesntExistInTheSchemaShouldFail() { String fieldType = "fieldTypeToBeDeleted"; SchemaRequest.DeleteFieldType deleteFieldTypeRequest = new SchemaRequest.DeleteFieldType(fieldType); @@ -848,7 +847,7 @@ public void testCopyFieldWithMaxCharsAccuracy() throws Exception { } @Test - public void copyFieldsShouldFailWhenOneOfTheFieldsDoesntExistInTheSchema() throws Exception { + public void copyFieldsShouldFailWhenOneOfTheFieldsDoesntExistInTheSchema() { String srcFieldName = "srcnotexist"; String destFieldName1 = "destNotExist1", destFieldName2 = "destNotExist2"; @@ -886,7 +885,7 @@ public void testDeleteCopyFieldAccuracy() throws Exception { } @Test - public void deleteCopyFieldShouldFailWhenOneOfTheFieldsDoesntExistInTheSchema() throws Exception { + public void deleteCopyFieldShouldFailWhenOneOfTheFieldsDoesntExistInTheSchema() { String srcFieldName = "copyfield"; String destFieldName1 = "destField1", destFieldName2 = "destField2"; SchemaRequest.DeleteCopyField deleteCopyFieldsRequest = diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index f1c62f17ee8..4ebb9d867a5 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -318,14 +318,6 @@ public static void teardownTestCases() throws Exception { } finally { TestInjection.reset(); initCoreDataDir = null; - System.clearProperty("zookeeper.forceSync"); - System.clearProperty("jetty.testMode"); - System.clearProperty("tests.shardhandler.randomSeed"); - System.clearProperty("solr.index.updatelog.enabled"); - System.clearProperty("useCompoundFile"); - System.clearProperty("urlScheme"); - System.clearProperty("solr.cloud.wait-for-updates-with-stale-state-pause"); - System.clearProperty("solr.zkclienttmeout"); HttpClientUtil.resetHttpClientBuilder(); HttpJettySolrClient.resetSslContextFactory(); @@ -405,8 +397,6 @@ public static void resetFactory() { if (savedFactory != null) { System.setProperty("solr.directoryFactory", savedFactory); savedFactory = null; - } else { - System.clearProperty("solr.directoryFactory"); } } @@ -812,8 +802,6 @@ public static void deleteCore() { h.close(); } - System.clearProperty("solr.directoryFactory"); - if (System.getProperty(UPDATELOG_SYSPROP) != null) { // clears the updatelog system property at the end of the test run System.clearProperty(UPDATELOG_SYSPROP); @@ -2758,19 +2746,13 @@ protected static void systemSetPropertySolrTestsMergePolicyFactory(String value) System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, value); } - protected static void systemClearPropertySolrTestsMergePolicyFactory() { - System.clearProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY); - } - @Deprecated // For backwards compatibility only. Please do not use in new tests. protected static void systemSetPropertyEnableUrlAllowList(boolean value) { System.setProperty(AllowListUrlChecker.ENABLE_URL_ALLOW_LIST, String.valueOf(value)); } @Deprecated // For backwards compatibility only. Please do not use in new tests. - protected static void systemClearPropertySolrEnableUrlAllowList() { - System.clearProperty(AllowListUrlChecker.ENABLE_URL_ALLOW_LIST); - } + protected static void systemClearPropertySolrEnableUrlAllowList() {} @SafeVarargs protected static T pickRandom(T... options) { @@ -2889,11 +2871,6 @@ public static DistributedUpdateProcessor createDistributedUpdateProcessor( */ private static void clearNumericTypesProperties() { org.apache.solr.schema.PointField.TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS = false; - System.clearProperty("solr.tests.numeric.points"); - System.clearProperty("solr.tests.numeric.points.dv"); - for (Class c : RANDOMIZED_NUMERIC_FIELDTYPES.keySet()) { - System.clearProperty("solr.tests." + c.getSimpleName() + "FieldType"); - } private_RANDOMIZED_NUMERIC_FIELDTYPES.clear(); } diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java index 48c17cc3f7b..0bb4f08edb2 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java @@ -112,7 +112,6 @@ import org.apache.solr.util.TimeOut; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; -import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.slf4j.Logger; @@ -328,11 +327,6 @@ public static void beforeClass() { System.setProperty("solrcloud.update.delay", "0"); } - @AfterClass - public static void afterClass() throws Exception { - System.clearProperty("solrcloud.update.delay"); - } - public AbstractFullDistribZkTestBase() { if (TEST_NIGHTLY) { sliceCount = 2; @@ -2198,16 +2192,6 @@ public void distribTearDown() throws Exception { try { super.distribTearDown(); } finally { - System.clearProperty(ZK_HOST); - System.clearProperty("collection"); - System.clearProperty(ENABLE_UPDATE_LOG); - System.clearProperty(REMOVE_VERSION_FIELD); - System.clearProperty("solr.directoryFactory"); - System.clearProperty(ZOOKEEPER_FORCE_SYNC); - System.clearProperty( - MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE); - System.clearProperty("zkHost"); - System.clearProperty("numShards"); } } } diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java index 43100f63c08..1c878ea605b 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java @@ -71,11 +71,6 @@ public static void aztAfterClass() throws Exception { deleteCore(); } finally { - System.clearProperty("zkHost"); - System.clearProperty("solrcloud.skip.autorecovery"); - System.clearProperty("solr.port.listen"); - System.clearProperty(ZOOKEEPER_FORCE_SYNC); - if (zkServer != null) { zkServer.shutdown(); zkServer = null; diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudAuthTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudAuthTestCase.java index 5f1081e05fb..97b39eec05c 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudAuthTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudAuthTestCase.java @@ -49,7 +49,6 @@ import org.apache.solr.security.AuthenticationPlugin; import org.apache.solr.util.SolrMetricTestUtils; import org.apache.solr.util.TimeOut; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,11 +82,6 @@ public static void enableMetrics() { System.setProperty("metricsEnabled", "true"); } - @AfterClass - public static void disableMetrics() { - System.clearProperty("metricsEnabled"); - } - /** Used to check metric counts for PKI auth */ protected void assertPkiAuthMetricsMinimums( int requests, diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java index a54b2af37b3..29b00ffd4e4 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java @@ -48,7 +48,6 @@ import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.CoreAdminParams; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; @@ -79,11 +78,6 @@ public static void createCluster() throws Exception { System.setProperty("solr.security.allow.paths", "*"); } - @AfterClass - public static void afterClass() throws Exception { - System.clearProperty("solr.security.allow.paths"); - } - /** * @return The name of the collection to use. */ @@ -115,7 +109,6 @@ public void test() throws Exception { replFactor = TestUtil.nextInt(random(), 1, 2); numTlogReplicas = TestUtil.nextInt(random(), 0, 1); numPullReplicas = TestUtil.nextInt(random(), 0, 1); - int backupReplFactor = replFactor + numPullReplicas + numTlogReplicas; CollectionAdminRequest.Create create = isImplicit diff --git a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java index 0d17dc41d92..605e56bf5a9 100644 --- a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java +++ b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java @@ -189,47 +189,44 @@ public void testMultipleClustersDiffZk() throws Exception { } public void testJettyUsingSysProp() throws Exception { - try { - // this cluster will use a system property to communicate zkHost to its nodes -- not node - // props in - // the servlet context - final MiniSolrCloudCluster x = - new MiniSolrCloudCluster(1, createTempDir(), JettyConfig.builder().build()) { - @Override - public JettySolrRunner startJettySolrRunner( - String name, JettyConfig config, String solrXml) throws Exception { - System.setProperty("zkHost", getZkServer().getZkAddress()); - - final Properties nodeProps = new Properties(); - nodeProps.setProperty("test-from-sysprop", "yup"); - - Path runnerPath = createTempDir(name); - if (solrXml == null) { - solrXml = DEFAULT_CLOUD_SOLR_XML; - } - Files.write(runnerPath.resolve("solr.xml"), solrXml.getBytes(StandardCharsets.UTF_8)); - JettyConfig newConfig = JettyConfig.builder(config).build(); - JettySolrRunner jetty = - new JettySolrRunner(runnerPath.toString(), nodeProps, newConfig); - return super.startJettySolrRunner(jetty); + + // this cluster will use a system property to communicate zkHost to its nodes -- not node + // props in + // the servlet context + final MiniSolrCloudCluster x = + new MiniSolrCloudCluster(1, createTempDir(), JettyConfig.builder().build()) { + @Override + public JettySolrRunner startJettySolrRunner( + String name, JettyConfig config, String solrXml) throws Exception { + System.setProperty("zkHost", getZkServer().getZkAddress()); + + final Properties nodeProps = new Properties(); + nodeProps.setProperty("test-from-sysprop", "yup"); + + Path runnerPath = createTempDir(name); + if (solrXml == null) { + solrXml = DEFAULT_CLOUD_SOLR_XML; } - }; - try { - // baseline check - assertEquals(1, x.getJettySolrRunners().size()); - assertZkHost("x", x.getZkServer().getZkAddress(), x.getJettySolrRunners().get(0)); + Files.write(runnerPath.resolve("solr.xml"), solrXml.getBytes(StandardCharsets.UTF_8)); + JettyConfig newConfig = JettyConfig.builder(config).build(); + JettySolrRunner jetty = + new JettySolrRunner(runnerPath.toString(), nodeProps, newConfig); + return super.startJettySolrRunner(jetty); + } + }; + try { + // baseline check + assertEquals(1, x.getJettySolrRunners().size()); + assertZkHost("x", x.getZkServer().getZkAddress(), x.getJettySolrRunners().get(0)); - // verify MiniSolrCloudCluster's impl didn't change out from under us making test useless - assertEquals( - "yup", - x.getJettySolrRunners().get(0).getNodeProperties().getProperty("test-from-sysprop")); - assertNull(x.getJettySolrRunners().get(0).getNodeProperties().getProperty("zkHost")); + // verify MiniSolrCloudCluster's impl didn't change out from under us making test useless + assertEquals( + "yup", + x.getJettySolrRunners().get(0).getNodeProperties().getProperty("test-from-sysprop")); + assertNull(x.getJettySolrRunners().get(0).getNodeProperties().getProperty("zkHost")); - } finally { - x.shutdown(); - } } finally { - System.clearProperty("zkHost"); + x.shutdown(); } }