From 726ac1883a7bc760da34e82d263832636fbb49a5 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 4 Mar 2012 18:52:20 +0000 Subject: [PATCH] audit clearing sys props git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1296855 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/org/apache/solr/cloud/AbstractZkTestCase.java | 6 +++--- .../apache/solr/cloud/LeaderElectionIntegrationTest.java | 5 +++++ .../test/org/apache/solr/cloud/NodeStateWatcherTest.java | 2 +- .../core/src/test/org/apache/solr/cloud/OverseerTest.java | 8 ++++---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java b/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java index fadc150079a..3db5d1cfe90 100644 --- a/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java +++ b/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java @@ -24,10 +24,8 @@ import java.util.Map; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.cloud.SolrZkClient; -import org.apache.solr.common.cloud.ZkCmdExecutor; import org.apache.solr.common.cloud.ZkNodeProps; import org.apache.solr.common.cloud.ZkStateReader; -import org.apache.solr.core.SolrConfig; import org.apache.zookeeper.CreateMode; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -61,7 +59,7 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 { System.setProperty("solrcloud.skip.autorecovery", "true"); System.setProperty("zkHost", zkServer.getZkAddress()); - System.setProperty("hostPort", "0000"); + System.setProperty("jetty.port", "0000"); buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), "solrconfig.xml", "schema.xml"); @@ -120,6 +118,8 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 { System.clearProperty("solr.test.sys.prop1"); System.clearProperty("solr.test.sys.prop2"); System.clearProperty("solrcloud.skip.autorecovery"); + System.clearProperty("jetty.port"); + zkServer.shutdown(); // wait just a bit for any zk client threads to outlast timeout 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 62d57177888..8c88580c24c 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java @@ -271,6 +271,11 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { @AfterClass public static void afterClass() throws InterruptedException { System.clearProperty("solrcloud.skip.autorecovery"); + System.clearProperty("zkClientTimeout"); + System.clearProperty("zkHost"); + System.clearProperty("shard"); + System.clearProperty("solr.data.dir"); + System.clearProperty("solr.solr.home"); resetExceptionIgnores(); // wait just a bit for any zk client threads to outlast timeout Thread.sleep(2000); diff --git a/solr/core/src/test/org/apache/solr/cloud/NodeStateWatcherTest.java b/solr/core/src/test/org/apache/solr/cloud/NodeStateWatcherTest.java index f743ebe5207..79e58fb39bf 100644 --- a/solr/core/src/test/org/apache/solr/cloud/NodeStateWatcherTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/NodeStateWatcherTest.java @@ -98,7 +98,7 @@ public class NodeStateWatcherTest extends SolrTestCaseJ4 { waitForCall(4, callCounter); assertEquals(0, watcher.getCurrentState().size()); } finally { - + System.clearProperty(ZkStateReader.NUM_SHARDS_PROP); if (zkClient != null) { zkClient.close(); } 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 ecee92bdc4d..72888e3ea02 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java @@ -237,6 +237,8 @@ public class OverseerTest extends SolrTestCaseJ4 { assertNotNull(reader.getLeaderUrl("collection1", "shard3", 15000)); } finally { + System.clearProperty(ZkStateReader.NUM_SHARDS_PROP); + System.clearProperty("bootstrap_confdir"); if (DEBUG) { if (zkController != null) { zkClient.printLayoutToStdOut(); @@ -250,8 +252,6 @@ public class OverseerTest extends SolrTestCaseJ4 { } server.shutdown(); } - - System.clearProperty(ZkStateReader.NUM_SHARDS_PROP); } @Test @@ -394,6 +394,8 @@ public class OverseerTest extends SolrTestCaseJ4 { } } finally { + System.clearProperty(ZkStateReader.NUM_SHARDS_PROP); + System.clearProperty("bootstrap_confdir"); if (DEBUG) { if (controllers[0] != null) { zkClient.printLayoutToStdOut(); @@ -414,8 +416,6 @@ public class OverseerTest extends SolrTestCaseJ4 { nodeExecutors[i].shutdownNow(); } } - - System.clearProperty(ZkStateReader.NUM_SHARDS_PROP); } //wait until collections are available