SOLR-7599: Remove cruft from SolrCloud tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1682168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-05-28 08:29:03 +00:00
parent be4d58c774
commit b74b925950
25 changed files with 49 additions and 356 deletions

View File

@ -104,6 +104,8 @@ Other Changes
* SOLR-7590: Finish and improve MDC context logging support. (Mark Miller)
* SOLR-7599: Remove cruft from SolrCloud tests. (shalin)
================== 5.2.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -30,7 +30,7 @@
<codecFactory class="solr.SchemaCodecFactory"/>
<updateHandler>
<updateLog enable="${enable.update.log}">
<updateLog enable="true">
<str name="dir">${solr.ulog.dir:}</str>
</updateLog>
</updateHandler>

View File

@ -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;

View File

@ -104,18 +104,6 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
CompletionService<Object> completionService;
Set<Future<Object>> 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<Runnable> tasks = executor.shutdownNow();
assertTrue(tasks.isEmpty());
System.clearProperty("numShards");
System.clearProperty("solr.xml.persist");
// insurance
DirectUpdateHandler2.commitOnClose = true;
}
}

View File

@ -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"));

View File

@ -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() {

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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"));

View File

@ -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;
}
}

View File

@ -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<String, Object> 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<String, Object> 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<String,List<Integer>> collectionInfos = new HashMap<>();
Map<String,List<Integer>> 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;

View File

@ -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";

View File

@ -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

View File

@ -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.
*/

View File

@ -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;
}
}

View File

@ -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),

View File

@ -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);

View File

@ -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

View File

@ -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 {

View File

@ -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);

View File

@ -51,23 +51,6 @@ import java.util.Set;
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) {

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -84,12 +84,10 @@ public class CloudSolrClientTest extends AbstractFullDistribZkTestBase {
@BeforeClass
public static void beforeSuperClass() {
AbstractZkTestCase.SOLRHOME = new File(SOLR_HOME());
}
@AfterClass
public static void afterSuperClass() {
// 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());
}
protected String getCloudSolrConfig() {
@ -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;