tests: clean up a bit

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1545005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-11-24 15:53:00 +00:00
parent 9a76dcdf9e
commit 513c277e73
1 changed files with 15 additions and 8 deletions

View File

@ -55,11 +55,12 @@ import org.junit.BeforeClass;
* work as expected. * work as expected.
*/ */
public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase { public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
private static final String SHARD1 = "shard1";
private static final String ONE_NODE_COLLECTION = "onenodecollection"; private static final String ONE_NODE_COLLECTION = "onenodecollection";
@BeforeClass @BeforeClass
public static void beforeThisClass2() throws Exception { public static void beforeThisClass2() throws Exception {
assumeFalse("FIXME: This test fails under Java 8 all the time, see SOLR-4711", Constants.JRE_IS_MINIMUM_JAVA8);
} }
public BasicDistributedZk2Test() { public BasicDistributedZk2Test() {
@ -144,14 +145,15 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
index_specific(client, "id", docId + 1, t1, "what happens here?"); index_specific(client, "id", docId + 1, t1, "what happens here?");
// expire a session... // expire a session...
CloudJettyRunner cloudJetty = shardToJetty.get("shard1").get(0); CloudJettyRunner cloudJetty = shardToJetty.get(SHARD1).get(0);
chaosMonkey.expireSession(cloudJetty.jetty); chaosMonkey.expireSession(cloudJetty.jetty);
indexr("id", docId + 1, t1, "slip this doc in"); indexr("id", docId + 1, t1, "slip this doc in");
waitForRecoveriesToFinish(false); waitForRecoveriesToFinish(false);
checkShardConsistency("shard1"); checkShardConsistency(SHARD1);
checkShardConsistency(SHARD2);
testFinished = true; testFinished = true;
} finally { } finally {
@ -185,9 +187,9 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
waitForCollection(cloudClient.getZkStateReader(), ONE_NODE_COLLECTION, 1); waitForCollection(cloudClient.getZkStateReader(), ONE_NODE_COLLECTION, 1);
waitForRecoveriesToFinish(ONE_NODE_COLLECTION, cloudClient.getZkStateReader(), false); waitForRecoveriesToFinish(ONE_NODE_COLLECTION, cloudClient.getZkStateReader(), false);
cloudClient.getZkStateReader().getLeaderRetry(ONE_NODE_COLLECTION, "shard1", 30000); cloudClient.getZkStateReader().getLeaderRetry(ONE_NODE_COLLECTION, SHARD1, 30000);
final String baseUrl2 = getBaseUrl((HttpSolrServer) clients.get(1)); final String baseUrl2 = getBaseUrl((HttpSolrServer) clients.get(random().nextInt(clients.size())));
HttpSolrServer qclient = new HttpSolrServer(baseUrl2 + "/onenodecollection" + "core"); HttpSolrServer qclient = new HttpSolrServer(baseUrl2 + "/onenodecollection" + "core");
// add a doc // add a doc
@ -502,12 +504,17 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
// new server should be part of first shard // new server should be part of first shard
// how many docs are on the new shard? // how many docs are on the new shard?
for (CloudJettyRunner cjetty : shardToJetty.get("shard1")) { for (CloudJettyRunner cjetty : shardToJetty.get(SHARD1)) {
if (VERBOSE) System.err.println("total:" if (VERBOSE) System.err.println("shard1 total:"
+ cjetty.client.solrClient.query(new SolrQuery("*:*")).getResults().getNumFound());
}
for (CloudJettyRunner cjetty : shardToJetty.get("shard2")) {
if (VERBOSE) System.err.println("shard2 total:"
+ cjetty.client.solrClient.query(new SolrQuery("*:*")).getResults().getNumFound()); + cjetty.client.solrClient.query(new SolrQuery("*:*")).getResults().getNumFound());
} }
checkShardConsistency("shard1"); checkShardConsistency(SHARD1);
checkShardConsistency("shard2");
assertDocCounts(VERBOSE); assertDocCounts(VERBOSE);
} }