From 95d93d52c5d4defe0864f2b374dfdb1eb726d3e7 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Fri, 12 Nov 2010 21:43:35 +0000 Subject: [PATCH] make test more robust to slowness git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1034580 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/cloud/CloudStateUpdateTest.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java b/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java index 1585e3f4a50..91ed374ce07 100644 --- a/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java +++ b/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java @@ -155,16 +155,24 @@ public class CloudStateUpdateTest extends SolrTestCaseJ4 { SolrCore core = container1.create(dcore); container1.register(core, false); - // slight pause - TODO: takes an oddly long amount of time to schedule tasks - // with almost no delay ... - Thread.sleep(5000); - ZkController zkController2 = container2.getZkController(); String host = zkController2.getHostName(); - - CloudState cloudState2 = zkController2.getCloudState(); - Map slices = cloudState2.getSlices("testcore"); + + // slight pause - TODO: takes an oddly long amount of time to schedule tasks + // with almost no delay ... + Thread.sleep(5000); + CloudState cloudState2 = null; + Map slices = null; + for (int i = 30; i > 0; i--) { + cloudState2 = zkController2.getCloudState(); + slices = cloudState2.getSlices("testcore"); + + if (slices.containsKey(host + ":1661_solr_testcore")) { + break; + } + Thread.sleep(500); + } assertNotNull(slices); assertTrue(slices.containsKey(host + ":1661_solr_testcore"));