diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 7e29433c508..55ee4c787c6 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -102,7 +102,9 @@ Other Changes * SOLR-7146: MiniSolrCloudCluster based tests can fail with ZooKeeperException NoNode for /live_nodes. (Vamsee Yarlagadda via shalin) -* SOLR-7590: Finish and improve MDC context logging support. (Mark Miller) +* SOLR-7590: Finish and improve MDC context logging support. (Mark Miller) + +* SOLR-7599: Remove cruft from SolrCloud tests. (shalin) ================== 5.2.0 ================== diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml index 654cb394957..b95c295d648 100644 --- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml +++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml @@ -30,7 +30,7 @@ - + ${solr.ulog.dir:} diff --git a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java index e0eb3e7ae56..0cc02a86370 100644 --- a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java @@ -52,21 +52,6 @@ public class AliasIntegrationTest extends AbstractFullDistribZkTestBase { private static final Logger logger = LoggerFactory.getLogger(AliasIntegrationTest.class); - @BeforeClass - public static void beforeSuperClass() throws Exception { - } - - @AfterClass - public static void afterSuperClass() { - - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - public AliasIntegrationTest() { super(); sliceCount = 1; diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java index 31aca7c8ff7..b712de526dd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java @@ -104,18 +104,6 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { CompletionService completionService; Set> pending; - @BeforeClass - public static void beforeThisClass2() throws Exception { - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - } - - public BasicDistributedZkTest() { sliceCount = 2; completionService = new ExecutorCompletionService<>(executor); @@ -1158,11 +1146,5 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { otherCollectionClients = null; List tasks = executor.shutdownNow(); assertTrue(tasks.isEmpty()); - - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - - // insurance - DirectUpdateHandler2.commitOnClose = true; } } 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 fb2619e016e..2bede8389f3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java @@ -91,16 +91,9 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase super.distribSetUp(); // can help to hide this when testing and looking at logs //ignoreException("shard update error"); - System.setProperty("numShards", Integer.toString(sliceCount)); useFactory("solr.StandardDirectoryFactory"); } - @Override - public void distribTearDown() throws Exception { - System.clearProperty("numShards"); - super.distribTearDown(); - } - public ChaosMonkeyNothingIsSafeTest() { super(); sliceCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.slicecount", "-1")); 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 c6dd00c4e01..f646238c212 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java @@ -71,16 +71,7 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase { @Override public void distribSetUp() throws Exception { useFactory("solr.StandardDirectoryFactory"); - super.distribSetUp(); - - System.setProperty("numShards", Integer.toString(sliceCount)); - } - - @Override - public void distribTearDown() throws Exception { - System.clearProperty("numShards"); - super.distribTearDown(); } public ChaosMonkeySafeLeaderTest() { diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java index 1db6652ef58..1df104ce016 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java @@ -54,12 +54,6 @@ public class CollectionReloadTest extends AbstractFullDistribZkTestBase { sliceCount = 1; } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - @Test public void testReloadedLeaderStateAfterZkSessionLoss() throws Exception { waitForThingsToLevelOut(30000); diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java index 71363e4f0ba..31e179c7047 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java @@ -38,17 +38,6 @@ import org.junit.Test; @Slow public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkTestBase { private static final int MAX_TIMEOUT_SECONDS = 60; - private static final boolean DEBUG = false; - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - - useJettyDataDir = false; - - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - } public CollectionsAPIAsyncDistributedZkTest() { sliceCount = 1; @@ -100,10 +89,6 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT assertEquals("Shard split did not complete. Last recorded state: " + state, "completed", state); } - - if (DEBUG) { - printLayout(); - } } private String getRequestStateAfterCompletion(String requestId, int waitForSeconds, SolrClient client) @@ -128,15 +113,4 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT NamedList innerResponse = (NamedList) response.getResponse().get("status"); return (String) innerResponse.get("state"); } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - - // insurance - DirectUpdateHandler2.commitOnClose = true; - } - } diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java index d24311f8da4..b5c3221f1aa 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java @@ -103,22 +103,14 @@ import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR; public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBase { private static final String DEFAULT_COLLECTION = "collection1"; - private static final boolean DEBUG = false; // we randomly use a second config set rather than just one private boolean secondConfigSet = random().nextBoolean(); - @BeforeClass - public static void beforeThisClass2() throws Exception { - - } - @Override public void distribSetUp() throws Exception { super.distribSetUp(); - useJettyDataDir = false; - if (secondConfigSet ) { String zkHost = zkServer.getZkHost(); String zkAddress = zkServer.getZkAddress(); @@ -146,9 +138,6 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "elevate.xml"); zkClient.close(); } - - System.setProperty("numShards", Integer.toString(sliceCount)); - } protected String getSolrXml() { @@ -191,10 +180,6 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa // last deleteCollectionWithDownNodes(); addReplicaTest(); - - if (DEBUG) { - super.printLayout(); - } } private void deleteCollectionRemovesStaleZkCollectionsNode() throws Exception { @@ -1162,16 +1147,6 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa waitForRecoveriesToFinish(COLL_NAME, false); } - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - - // insurance - DirectUpdateHandler2.commitOnClose = true; - } - private void clusterPropTest() throws Exception { try (CloudSolrClient client = createCloudClient(null)) { assertTrue("cluster property not set", setClusterProp(client, ZkStateReader.LEGACY_CLOUD, "false")); diff --git a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java index f7258e87b29..a5a3c7631c8 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java @@ -75,17 +75,6 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase { private static final String DEFAULT_COLLECTION = "collection1"; private static final boolean DEBUG = false; - @BeforeClass - public static void beforeThisClass2() throws Exception { - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - } - protected String getSolrXml() { return "solr-no-core.xml"; } @@ -451,14 +440,4 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase { QueryResponse rsp = getCommonCloudSolrClient().query(params); return rsp; } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - - // insurance - DirectUpdateHandler2.commitOnClose = true; - } } diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java index 94729fe6d35..2ea34b20d20 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java @@ -42,28 +42,8 @@ import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP; import static org.apache.solr.common.cloud.ZkNodeProps.makeMap; import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICA; -@Ignore("SOLR-6347") +@Ignore("SOLR-6347,SOLR-6593") public class DeleteLastCustomShardedReplicaTest extends AbstractFullDistribZkTestBase { - private CloudSolrClient client; - - @BeforeClass - public static void beforeThisClass2() throws Exception { - - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - client = createCloudClient(null); - } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - client.close(); - } protected String getSolrXml() { return "solr-no-core.xml"; @@ -76,39 +56,41 @@ public class DeleteLastCustomShardedReplicaTest extends AbstractFullDistribZkTes @Test @ShardsFixed(num = 2) public void test() throws Exception { - int replicationFactor = 1; - int maxShardsPerNode = 5; + try (CloudSolrClient client = createCloudClient(null)) { + int replicationFactor = 1; + int maxShardsPerNode = 5; - Map props = ZkNodeProps.makeMap( - "router.name", ImplicitDocRouter.NAME, - ZkStateReader.REPLICATION_FACTOR, replicationFactor, - ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode, - NUM_SLICES, 1, - SHARDS_PROP,"a,b"); + Map props = ZkNodeProps.makeMap( + "router.name", ImplicitDocRouter.NAME, + ZkStateReader.REPLICATION_FACTOR, replicationFactor, + ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode, + NUM_SLICES, 1, + SHARDS_PROP,"a,b"); - Map> collectionInfos = new HashMap<>(); + Map> collectionInfos = new HashMap<>(); - String collectionName = "customcollreplicadeletion"; + String collectionName = "customcollreplicadeletion"; - createCollection(collectionInfos, collectionName, props, client); + createCollection(collectionInfos, collectionName, props, client); - waitForRecoveriesToFinish(collectionName, false); + waitForRecoveriesToFinish(collectionName, false); - DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader() - .getClusterState().getCollection(collectionName); - Replica replica = testcoll.getSlice("a").getReplicas().iterator().next(); + DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader() + .getClusterState().getCollection(collectionName); + Replica replica = testcoll.getSlice("a").getReplicas().iterator().next(); - removeAndWaitForLastReplicaGone(collectionName, replica, "a"); + removeAndWaitForLastReplicaGone(client, collectionName, replica, "a"); + } } - protected void removeAndWaitForLastReplicaGone(String COLL_NAME, Replica replica, String shard) + protected void removeAndWaitForLastReplicaGone(CloudSolrClient client, String COLL_NAME, Replica replica, String shard) throws SolrServerException, IOException, InterruptedException { Map m = makeMap("collection", COLL_NAME, "action", DELETEREPLICA.toLower(), "shard", shard, "replica", replica.getName()); SolrParams params = new MapSolrParams(m); SolrRequest request = new QueryRequest(params); request.setPath("/admin/collections"); - this.client.request(request); + client.request(request); long endAt = System.currentTimeMillis() + 3000; boolean success = false; DocCollection testcoll = null; diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java index 2a8cef696e9..dcf86de241b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java @@ -48,21 +48,6 @@ import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE; import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICA; public class DeleteReplicaTest extends AbstractFullDistribZkTestBase { - private CloudSolrClient client; - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - client = createCloudClient(null); - } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - client.close(); - } protected String getSolrXml() { return "solr-no-core.xml"; @@ -78,15 +63,15 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase { String collectionName = "delLiveColl"; try (CloudSolrClient client = createCloudClient(null)) { createCollection(collectionName, client); - + waitForRecoveriesToFinish(collectionName, false); - + DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader() .getClusterState().getCollection(collectionName); - + Slice shard1 = null; Replica replica1 = null; - + // Get an active replica for (Slice slice : testcoll.getSlices()) { if(replica1 != null) diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java index 844cd13e974..e3e068253f3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java @@ -44,20 +44,6 @@ public class DeleteShardTest extends AbstractFullDistribZkTestBase { sliceCount = 2; } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", "2"); - System.setProperty("solr.xml.persist", "true"); - } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - } - // TODO: Custom hash slice deletion test @Test diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java index 06efc959a7a..cc53b31dcab 100644 --- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java @@ -78,12 +78,6 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase { fixShardCount(3); } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - /** * Overrides the parent implementation to install a SocketProxy in-front of the Jetty server. */ diff --git a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java index 2ef4d123aa8..a5e9614e648 100644 --- a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java @@ -49,16 +49,6 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase { private static final int NUM_COLLECTIONS = 4; - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - - useJettyDataDir = false; - - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - } - public MultiThreadedOCPTest() { sliceCount = 2; } @@ -296,16 +286,6 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase { return (String) innerResponse.get("state"); } - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - System.clearProperty("numShards"); - System.clearProperty("solr.xml.persist"); - - // insurance - DirectUpdateHandler2.commitOnClose = true; - } - } diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java index 9b706fb9297..e8a6d3055b4 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java @@ -50,28 +50,8 @@ import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE; import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR; @LuceneTestCase.Slow -@SuppressSSL // See SOLR-5776 +@SuppressSSL(bugUrl = "SOLR-5776") public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ - private CloudSolrClient client; - - @BeforeClass - public static void beforeThisClass2() throws Exception { - - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - client = createCloudClient(null); - } - - @Override - public void distribTearDown() throws Exception { - super.distribTearDown(); - client.close(); - } protected String getSolrXml() { return "solr-no-core.xml"; @@ -84,11 +64,13 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ @Test public void test() throws Exception { - testQuitCommand(); - testOverseerRole(); + try (CloudSolrClient client = createCloudClient(null)) { + testQuitCommand(client); + testOverseerRole(client); + } } - private void testQuitCommand() throws Exception{ + private void testQuitCommand(CloudSolrClient client) throws Exception{ String collectionName = "testOverseerQuit"; createCollection(collectionName, client); @@ -119,7 +101,7 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ - private void testOverseerRole() throws Exception { + private void testOverseerRole(CloudSolrClient client) throws Exception { String collectionName = "testOverseerCol"; createCollection(collectionName, client); @@ -135,7 +117,7 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ Collections.shuffle(l, random()); String overseerDesignate = l.get(0); log.info("overseerDesignate {}",overseerDesignate); - setOverseerRole(CollectionAction.ADDROLE,overseerDesignate); + setOverseerRole(client, CollectionAction.ADDROLE,overseerDesignate); long timeout = System.currentTimeMillis()+15000; @@ -164,7 +146,7 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ String anotherOverseer = l.get(0); log.info("Adding another overseer designate {}", anotherOverseer); - setOverseerRole(CollectionAction.ADDROLE, anotherOverseer); + setOverseerRole(client, CollectionAction.ADDROLE, anotherOverseer); String currentOverseer = getLeaderNode(client.getZkStateReader().getZkClient()); @@ -209,7 +191,7 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{ assertTrue("New overseer designate has not become the overseer, expected : " + anotherOverseer + "actual : " + getLeaderNode(client.getZkStateReader().getZkClient()), leaderchanged); } - private void setOverseerRole(CollectionAction action, String overseerDesignate) throws Exception, IOException { + private void setOverseerRole(CloudSolrClient client, CollectionAction action, String overseerDesignate) throws Exception, IOException { log.info("Adding overseer designate {} ", overseerDesignate); Map m = makeMap( "action", action.toString().toLowerCase(Locale.ROOT), diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java index 941baf609f0..60b66336ee2 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java @@ -27,16 +27,11 @@ public class OverseerStatusTest extends BasicDistributedZkTest { public OverseerStatusTest() { schemaString = "schema15.xml"; // we need a string id - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); + sliceCount = 1; } @Test + @ShardsFixed(num = 1) public void test() throws Exception { waitForThingsToLevelOut(15); diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java index a610b78bbd8..404cbdd63bd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java @@ -59,29 +59,6 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase { fixShardCount(3); } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - - @Override - public void distribTearDown() throws Exception { - - log.info("tearing down replicationFactorTest!"); - - System.clearProperty("numShards"); - - super.distribTearDown(); - - log.info("super.distribTearDown complete, closing all socket proxies"); - if (!proxies.isEmpty()) { - for (SocketProxy proxy : proxies.values()) { - proxy.close(); - } - } - } - /** * Overrides the parent implementation so that we can configure a socket proxy * to sit infront of each Jetty server, which gives us the ability to simulate diff --git a/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java b/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java index 922caa6e9a4..1dcfd791a87 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java @@ -64,13 +64,6 @@ public class ShardSplitTest extends BasicDistributedZkTest { schemaString = "schema15.xml"; // we need a string id } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - System.setProperty("solr.xml.persist", "true"); - } - @Test public void test() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java index a7155cf18ce..7284cc730a4 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java @@ -51,12 +51,6 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase { sliceCount = 2; } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - @Test public void testLoadDocsIntoGettingStartedCollection() throws Exception { waitForThingsToLevelOut(30000); diff --git a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java index a35f69e5d81..97f06828992 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java @@ -50,24 +50,7 @@ import java.util.Set; @Slow public class SyncSliceTest extends AbstractFullDistribZkTestBase { private boolean success = false; - - @BeforeClass - public static void beforeSuperClass() throws Exception { - } - - @AfterClass - public static void afterSuperClass() { - - } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - // we expect this time of exception as shards go up and down... - //ignoreException(".*"); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - + @Override public void distribTearDown() throws Exception { if (!success) { @@ -75,7 +58,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { } super.distribTearDown(); } - + public SyncSliceTest() { super(); sliceCount = 1; diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java index cc4602dbfe1..d60532e50f5 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java @@ -52,12 +52,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase { public TestCollectionAPI() { schemaString = "schema15.xml"; // we need a string id - } - - @Override - public void distribSetUp() throws Exception { sliceCount = 2; - super.distribSetUp(); } @Test diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java b/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java index 80774cc8f60..49a7817c5f7 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java @@ -71,12 +71,6 @@ public class TestCryptoKeys extends AbstractFullDistribZkTestBase { } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - System.setProperty("numShards", Integer.toString(sliceCount)); - } - public TestCryptoKeys() { super(); sliceCount = 1; diff --git a/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java b/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java index abfff36b023..b9ca811c451 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java +++ b/solr/core/src/test/org/apache/solr/schema/TestCloudSchemaless.java @@ -47,19 +47,9 @@ import java.util.TreeMap; */ @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class TestCloudSchemaless extends AbstractFullDistribZkTestBase { - private static final Logger log = LoggerFactory.getLogger(TestCloudManagedSchemaConcurrent.class); + private static final Logger log = LoggerFactory.getLogger(TestCloudSchemaless.class); private static final String SUCCESS_XPATH = "/response/lst[@name='responseHeader']/int[@name='status'][.='0']"; - @Override - public void distribSetUp() throws Exception { - - super.distribSetUp(); - - useJettyDataDir = false; - - System.setProperty("numShards", Integer.toString(sliceCount)); - } - @After public void teardDown() throws Exception { super.tearDown(); @@ -76,7 +66,6 @@ public class TestCloudSchemaless extends AbstractFullDistribZkTestBase { @BeforeClass public static void initSysProperties() { System.setProperty("managed.schema.mutable", "true"); - System.setProperty("enable.update.log", "true"); } @Override diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java index 0d0869aef87..b4ca40996fe 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java @@ -84,14 +84,12 @@ public class CloudSolrClientTest extends AbstractFullDistribZkTestBase { @BeforeClass public static void beforeSuperClass() { - AbstractZkTestCase.SOLRHOME = new File(SOLR_HOME()); + // this is necessary because AbstractZkTestCase.buildZooKeeper is used by AbstractDistribZkTestBase + // and the auto-detected SOLRHOME=TEST_HOME() does not exist for solrj tests + // todo fix this + AbstractZkTestCase.SOLRHOME = new File(SOLR_HOME()); } - - @AfterClass - public static void afterSuperClass() { - - } - + protected String getCloudSolrConfig() { return "solrconfig.xml"; } @@ -105,15 +103,6 @@ public class CloudSolrClientTest extends AbstractFullDistribZkTestBase { return SOLR_HOME; } - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - // we expect this time of exception as shards go up and down... - //ignoreException(".*"); - - System.setProperty("numShards", Integer.toString(sliceCount)); - } - public CloudSolrClientTest() { super(); sliceCount = 2;