From 91b1e22789934146ffa4e6c6fa71f708978b60b6 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 10 Feb 2013 02:07:54 +0000 Subject: [PATCH] test: work on hardening this test git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1444472 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/cloud/SyncSliceTest.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) 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 51cf0cfb40d..68a6c714179 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java @@ -97,7 +97,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { waitForThingsToLevelOut(15); del("*:*"); - List skipServers = new ArrayList(); + List skipServers = new ArrayList(); int docId = 0; indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1, "to come to the aid of their country."); @@ -105,12 +105,12 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1, "old haven was blue."); - skipServers.add(shardToJetty.get("shard1").get(1).url + "/"); + skipServers.add(shardToJetty.get("shard1").get(1)); indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1, "but the song was fancy."); - skipServers.add(shardToJetty.get("shard1").get(2).url + "/"); + skipServers.add(shardToJetty.get("shard1").get(2)); indexDoc(skipServers, id,docId++, i1, 50, tlong, 50, t1, "under the moon and over the lake"); @@ -189,7 +189,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { waitTillRecovered(); skipServers = getRandomOtherJetty(leaderJetty, null); - skipServers.addAll( getRandomOtherJetty(leaderJetty, null)); + skipServers.addAll( getRandomOtherJetty(leaderJetty, skipServers.get(0))); // skip list should be //System.out.println("leader:" + leaderJetty.url); @@ -290,13 +290,9 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { } return shardFailMessage; } - - private List getRandomJetty() { - return getRandomOtherJetty(null, null); - } - private List getRandomOtherJetty(CloudJettyRunner leader, CloudJettyRunner down) { - List skipServers = new ArrayList(); + private List getRandomOtherJetty(CloudJettyRunner leader, CloudJettyRunner down) { + List skipServers = new ArrayList(); List candidates = new ArrayList(); candidates.addAll(shardToJetty.get("shard1")); @@ -309,11 +305,11 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { } CloudJettyRunner cjetty = candidates.get(random().nextInt(candidates.size())); - skipServers.add(cjetty.url + "/"); + skipServers.add(cjetty); return skipServers; } - protected void indexDoc(List skipServers, Object... fields) throws IOException, + protected void indexDoc(List skipServers, Object... fields) throws IOException, SolrServerException { SolrInputDocument doc = new SolrInputDocument(); @@ -325,8 +321,8 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase { UpdateRequest ureq = new UpdateRequest(); ureq.add(doc); ModifiableSolrParams params = new ModifiableSolrParams(); - for (String skip : skipServers) { - params.add("test.distrib.skip.servers", skip); + for (CloudJettyRunner skip : skipServers) { + params.add("test.distrib.skip.servers", skip.url + "/"); } ureq.setParams(params); ureq.process(cloudClient);