From c618516338b6dc1a08070ec3046e7089dceebbed Mon Sep 17 00:00:00 2001 From: Sami Siren Date: Thu, 23 Feb 2012 11:44:00 +0000 Subject: [PATCH] SOLR-3080: add couple more asserts git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292753 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/org/apache/solr/cloud/ZkControllerTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java index d04e91a3da5..e42bf362ef8 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java @@ -22,6 +22,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import junit.framework.Assert; + import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.cloud.SolrZkClient; import org.apache.solr.common.cloud.ZkNodeProps; @@ -197,6 +199,8 @@ public class ZkControllerTest extends SolrTestCaseJ4 { assertNotNull(reader.getLeaderUrl("collection1", "shard1", 15000)); + assertEquals("Shard(s) missing from cloudstate", 2, zkController.getZkStateReader().getCloudState().getSlice("collection1", "shard1").getShards().size()); + // unregister current leader final ZkNodeProps shard1LeaderProps = reader.getLeaderProps( "collection1", "shard1"); @@ -215,6 +219,9 @@ public class ZkControllerTest extends SolrTestCaseJ4 { leaderUrl, reader.getLeaderUrl("collection1", "shard1", 15000)); assertNotNull("New leader was null.", reader.getLeaderUrl("collection1", "shard1", 15000)); + + Thread.sleep(1000); + assertEquals("shard was not unregistered", 1, zkController.getZkStateReader().getCloudState().getSlice("collection1", "shard1").getShards().size()); } finally { if (DEBUG) { if (zkController != null) {