SOLR-4923: do not test if not sending to leaders first

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1493861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-06-17 17:58:07 +00:00
parent 4f05d88704
commit 6b06ac1026
2 changed files with 34 additions and 26 deletions

View File

@ -356,6 +356,10 @@ public class CloudSolrServer extends SolrServer {
return lbServer;
}
public boolean isUpdatesToLeaders() {
return updatesToLeaders;
}
// for tests
Map<String,List<String>> getUrlLists() {
return urlLists;

View File

@ -102,9 +102,11 @@ public class CloudSolrServerTest extends AbstractFullDistribZkTestBase {
indexr(id, 0, "a_t", "to come to the aid of their country.");
// compare leaders list
CloudJettyRunner shard1Leader = shardToLeaderJetty.get("shard1");
CloudJettyRunner shard2Leader = shardToLeaderJetty.get("shard2");
if (cloudClient.isUpdatesToLeaders()) {
// compare leaders list
assertEquals(2, cloudClient.getLeaderUrlLists().get("collection1").size());
HashSet<String> leaderUrlSet = new HashSet<String>();
leaderUrlSet.addAll(cloudClient.getLeaderUrlLists().get("collection1"));
@ -126,12 +128,14 @@ public class CloudSolrServerTest extends AbstractFullDistribZkTestBase {
replicas.remove(shard1Leader.url);
replicas.remove(shard2Leader.url);
assertEquals(replicas.size(), cloudClient.getReplicasLists().get("collection1").size());
assertEquals(replicas.size(),
cloudClient.getReplicasLists().get("collection1").size());
for (String url : cloudClient.getReplicasLists().get("collection1")) {
assertTrue("fail check for replica:" + url + " in " + replicas,
replicas.contains(stripTrailingSlash(url)));
}
}
}