Skip to content

Apache Lucene open-source search software

SOLR-12679: MiniSolrCloudCluster.stopJettySolrRunner should remove jetty from the internal list

Shalin Shekhar Mangaree498f5a38c0
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 785dada1ba2..8f8ffc45eda 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -247,6 +247,8 @@ Bug Fixes
* SOLR-12674: RollupStream should not use the HashQueryParser for 1 worker. (Varun Thacker)
+* SOLR-12679: MiniSolrCloudCluster.stopJettySolrRunner should remove jetty from the internal list. (shalin)
+
Optimizations
----------------------
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 067ec70b225..6ee616fd842 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
@@ -205,7 +205,7 @@ public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase {
final CloudSolrClient client = cluster.getSolrClient();
assertNotNull(cluster.getZkServer());
- List<JettySolrRunner> jettys = cluster.getJettySolrRunners();
+ List<JettySolrRunner> jettys = new ArrayList<>(cluster.getJettySolrRunners()); // make a copy
assertEquals(nodeCount, jettys.size());
for (JettySolrRunner jetty : jettys) {
assertTrue(jetty.isRunning());
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 df458d7877d..8b442db3083 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
@@ -427,8 +427,15 @@ public class MiniSolrCloudCluster {
return jetty;
}
+ /**
+ * Stop the given Solr instance. It will be removed from the cluster's list of running instances.
+ * @param jetty a {@link JettySolrRunner} to be stopped
+ * @return the same {@link JettySolrRunner} instance provided to this method
+ * @throws Exception on error
+ */
public JettySolrRunner stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
jetty.stop();
+ jettys.remove(jetty);
return jetty;
}