diff --git a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java index d0d10fda0297..6255aa168b6b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java @@ -437,8 +437,6 @@ public void testThatCantForwardToLeaderFails() throws Exception { // create a new node for the purpose of killing it... final JettySolrRunner leaderToPartition = cluster.startJettySolrRunner(); try { - cluster.waitForNode(leaderToPartition, DEFAULT_TIMEOUT); - // HACK: we have to stop the node in order to enable the proxy, in order to then restart the // node // (in order to then "partition it" later via the proxy) @@ -451,7 +449,6 @@ public void testThatCantForwardToLeaderFails() throws Exception { try { log.info("leaderToPartition's Proxy: {}", proxy); - cluster.waitForNode(leaderToPartition, DEFAULT_TIMEOUT); // create a 2x1 collection using a nodeSet that includes our leaderToPartition... assertEquals( RequestStatusState.COMPLETED, diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java index bc44ef1ba00a..427020a7755f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java @@ -189,7 +189,6 @@ public void testPeersyncFailureReplicationSuccess() throws Exception { ZkStateReader.from(solrClient).registerCollectionStateWatcher(collectionName, stateWatcher); JettySolrRunner newNode = cluster.startJettySolrRunner(); - cluster.waitForAllNodes(30); CollectionAdminRequest.addReplicaToShard(collectionName, "shard1") .setNode(newNode.getNodeName()) .process(solrClient); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterSSL.java b/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterSSL.java index 457429a21ac0..2253ba85f8dd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterSSL.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterSSL.java @@ -270,7 +270,6 @@ public static void checkClusterWithCollectionCreations( // create a new server JettySolrRunner startedServer = cluster.startJettySolrRunner(); - cluster.waitForAllNodes(30); assertTrue(startedServer.isRunning()); assertEquals(NUM_SERVERS, cluster.getJettySolrRunners().size()); diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java index 7f8634e448a1..4474317e2247 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java @@ -117,7 +117,6 @@ public void testCollectionCreateSearchDelete() throws Exception { // create a server JettySolrRunner startedServer = cluster.startJettySolrRunner(); - cluster.waitForAllNodes(30); assertTrue(startedServer.isRunning()); assertEquals(nodeCount, cluster.getJettySolrRunners().size()); @@ -162,7 +161,6 @@ public void testCollectionCreateSearchDelete() throws Exception { // re-create a server (to restore original nodeCount count) startedServer = cluster.startJettySolrRunner(jettyToStop); - cluster.waitForAllNodes(30); assertTrue(startedServer.isRunning()); assertEquals(nodeCount, cluster.getJettySolrRunners().size()); diff --git a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java index 6f217be9644c..6fdcfe7fb848 100644 --- a/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java +++ b/solr/core/src/test/org/apache/solr/cluster/events/ClusterEventProducerTest.java @@ -164,7 +164,6 @@ public void testEvents() throws Exception { // NODES_UP eventsListener.setExpectedType(ClusterEvent.EventType.NODES_UP); JettySolrRunner newNode = cluster.startJettySolrRunner(); - cluster.waitForNode(newNode, 60); eventsListener.waitForExpectedEvent(30); assertNotNull( "should be NODES_UP events", eventsListener.events.get(ClusterEvent.EventType.NODES_UP)); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java index 19c1a75de399..bb11e669b087 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java @@ -46,7 +46,6 @@ public void testCloudClientCanConnectAfterClusterComesUp() throws Exception { e.getMessage().contains("cluster not found/not ready")); cluster.startJettySolrRunner(); - cluster.waitForAllNodes(30); client.connect(20, TimeUnit.SECONDS); // should work now! @@ -77,7 +76,6 @@ public void testCloudClientUploads() throws Exception { e.getMessage().contains("cluster not found/not ready")); cluster.startJettySolrRunner(); - cluster.waitForAllNodes(30); client.connect(20, TimeUnit.SECONDS); cluster.getZkClient().upConfig(configPath, "testconfig"); diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java index d4e99dac6963..c99080896c4b 100644 --- a/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java +++ b/solr/solrj/src/test/org/apache/solr/common/cloud/TestCollectionStateWatchers.java @@ -139,8 +139,6 @@ private void doTestCollectionWatchWithNodeShutdown(final boolean shutdownUnusedN shutdownUnusedNode ? extraJetty : cluster.getJettySolrRunners().get(0); final int expectedNodesWithActiveReplicas = CLUSTER_SIZE - (shutdownUnusedNode ? 0 : 1); - cluster.waitForAllNodes(MAX_WAIT_TIMEOUT); - // shutdown a node and check that we get notified about the change final CountDownLatch latch = new CountDownLatch(1); ZkStateReader.from(client) diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java index ee8ced5a367d..b0247a525c2d 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java @@ -472,7 +472,9 @@ public JettySolrRunner getJettySolrRunner(int index) { } /** - * Start a new Solr instance on a particular servlet context + * Start a new Solr instance on a particular servlet context. Waits for the node to appear in + * cluster live nodes before returning (unless called during initial cluster construction, in + * which case the constructor's own {@link #waitForAllNodes} handles this). * * @param name the instance name * @param config a JettyConfig for the instance's {@link org.apache.solr.embedded.JettySolrRunner} @@ -500,11 +502,17 @@ public JettySolrRunner startJettySolrRunner(String name, JettyConfig config, Str synchronized (startupWait) { startupWait.notifyAll(); } + // solrClient is null during the initial parallel cluster startup in the constructor; + // in that case the constructor's waitForAllNodes call handles node synchronization. + if (solrClient != null) { + waitForNode(jetty, DEFAULT_TIMEOUT); + } return jetty; } /** - * Start a new Solr instance, using the default config + * Start a new Solr instance, using the default config. Waits for the node to appear in cluster + * live nodes before returning. * * @return a JettySolrRunner */ @@ -513,7 +521,8 @@ public JettySolrRunner startJettySolrRunner() throws Exception { } /** - * Add a previously stopped node back to the cluster on a different port + * Add a previously stopped node back to the cluster on a different port. Waits for the node to + * appear in cluster live nodes before returning. * * @param jetty a {@link JettySolrRunner} previously returned by {@link #stopJettySolrRunner(int)} * @return the started node @@ -524,7 +533,8 @@ public JettySolrRunner startJettySolrRunner(JettySolrRunner jetty) throws Except } /** - * Add a previously stopped node back to the cluster + * Add a previously stopped node back to the cluster. Waits for the node to appear in cluster live + * nodes before returning. * * @param jetty a {@link JettySolrRunner} previously returned by {@link #stopJettySolrRunner(int)} * @param reusePort the port previously used by jetty @@ -535,6 +545,7 @@ public JettySolrRunner startJettySolrRunner(JettySolrRunner jetty, boolean reuse throws Exception { jetty.start(reusePort); if (!jettys.contains(jetty)) jettys.add(jetty); + waitForNode(jetty, DEFAULT_TIMEOUT); return jetty; }