SOLR-5311 tests were failing intermittently

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1537060 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2013-10-30 12:10:20 +00:00
parent d9c28a0efc
commit cd49552b57
1 changed files with 34 additions and 4 deletions

View File

@ -28,7 +28,10 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.MapSolrParams; import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import java.net.URL;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.concurrent.Future;
import static org.apache.solr.common.cloud.ZkNodeProps.makeMap; import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
@ -43,11 +46,38 @@ public class DeleteInactiveReplicaTest extends DeleteReplicaTest{
CloudSolrServer client = createCloudClient(null); CloudSolrServer client = createCloudClient(null);
createCloudClient(null); createCloudClient(null);
createColl(COLL_NAME, client); createColl(COLL_NAME, client);
boolean stopped = false;
JettySolrRunner stoppedJetty = null;
StringBuilder sb = new StringBuilder();
Replica replica1=null;
Slice shard1 = null;
DocCollection testcoll = getCommonCloudSolrServer().getZkStateReader().getClusterState().getCollection(COLL_NAME); DocCollection testcoll = getCommonCloudSolrServer().getZkStateReader().getClusterState().getCollection(COLL_NAME);
final Slice shard1 = testcoll.getSlices().iterator().next(); for (JettySolrRunner jetty : jettys) sb.append(jetty.getBaseUrl()).append(",");
for (Slice slice : testcoll.getActiveSlices()) {
for (Replica replica : slice.getReplicas())
for (JettySolrRunner jetty : jettys) {
URL baseUrl = null;
try {
baseUrl = jetty.getBaseUrl();
} catch (Exception e) {
continue;
}
if (baseUrl.toString().startsWith(replica.getStr(ZkStateReader.BASE_URL_PROP))) {
stoppedJetty = jetty;
ChaosMonkey.stop(jetty);
replica1 = replica;
shard1 = slice;
stopped = true;
break;
}
}
}
/*final Slice shard1 = testcoll.getSlices().iterator().next();
if(!shard1.getState().equals(Slice.ACTIVE)) fail("shard is not active"); if(!shard1.getState().equals(Slice.ACTIVE)) fail("shard is not active");
Replica replica1 = shard1.getReplicas().iterator().next(); Replica replica1 = shard1.getReplicas().iterator().next();
boolean stopped = false;
JettySolrRunner stoppedJetty = null; JettySolrRunner stoppedJetty = null;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (JettySolrRunner jetty : jettys) { for (JettySolrRunner jetty : jettys) {
@ -58,9 +88,9 @@ public class DeleteInactiveReplicaTest extends DeleteReplicaTest{
stopped = true; stopped = true;
break; break;
} }
} }*/
if(!stopped){ if(!stopped){
fail("Could not find jetty for replica "+ replica1 + "jettys: "+sb); fail("Could not find jetty to stop in collection "+ testcoll + " jettys: "+sb);
} }
long endAt = System.currentTimeMillis()+3000; long endAt = System.currentTimeMillis()+3000;