lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject lucene-solr:jira/solr-11702: SOLR-11702: ZkShardTermsTest.testParticipationOfReplicas should wait for terms get updated
Date Wed, 20 Dec 2017 07:07:47 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-11702 d98ca9df9 -> 91b1a7719


SOLR-11702: ZkShardTermsTest.testParticipationOfReplicas should wait for terms get updated


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/91b1a771
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/91b1a771
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/91b1a771

Branch: refs/heads/jira/solr-11702
Commit: 91b1a7719a57fd48a1ab1e74ce9234a170ff4092
Parents: d98ca9d
Author: Cao Manh Dat <datcm@apache.org>
Authored: Wed Dec 20 14:06:08 2017 +0700
Committer: Cao Manh Dat <datcm@apache.org>
Committed: Wed Dec 20 14:06:08 2017 +0700

----------------------------------------------------------------------
 .../test/org/apache/solr/cloud/ZkShardTermsTest.java    | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/91b1a771/solr/core/src/test/org/apache/solr/cloud/ZkShardTermsTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkShardTermsTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkShardTermsTest.java
index 54503b4..b31fc5f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ZkShardTermsTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ZkShardTermsTest.java
@@ -50,7 +50,7 @@ public class ZkShardTermsTest extends SolrCloudTestCase {
         .configure();
   }
 
-  public void testParticipationOfReplicas() throws IOException, SolrServerException {
+  public void testParticipationOfReplicas() throws IOException, SolrServerException, InterruptedException
{
     String collection = "collection1";
     try (ZkShardTerms zkShardTerms = new ZkShardTerms(collection, "shard2", cluster.getZkClient()))
{
       zkShardTerms.registerTerm("replica1");
@@ -64,12 +64,10 @@ public class ZkShardTermsTest extends SolrCloudTestCase {
         .setMaxShardsPerNode(1000)
         .process(cluster.getSolrClient());
     ZkController zkController = cluster.getJettySolrRunners().get(0).getCoreContainer().getZkController();
-    Map<String,Long> terms = zkController.getShardTerms(collection, "shard1").getTerms();
-    assertEquals(2, terms.size());
-    assertArrayEquals(new Long[]{0L, 0L}, terms.values().toArray(new Long[2]));
-    terms = zkController.getShardTerms(collection, "shard2").getTerms();
-    assertEquals(2, terms.size());
-    assertArrayEquals(new Long[]{0L, 0L}, terms.values().toArray(new Long[2]));
+    waitFor(2, () -> zkController.getShardTerms(collection, "shard1").getTerms().size());
+    assertArrayEquals(new Long[]{0L, 0L}, zkController.getShardTerms(collection, "shard1").getTerms().values().toArray(new
Long[2]));
+    waitFor(2, () -> zkController.getShardTerms(collection, "shard2").getTerms().size());
+    assertArrayEquals(new Long[]{0L, 0L}, zkController.getShardTerms(collection, "shard1").getTerms().values().toArray(new
Long[2]));
   }
 
   public void testRegisterTerm() throws InterruptedException {


Mime
View raw message