Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-18024 Flaky test CloudHttp2SolrClientTest.testHttpCspPerf (#3938)

Jan Høydahl5201ea82f9e0
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index 95ac8ef41a5..536f89c4962 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -109,6 +109,10 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
@BeforeClass
public static void setupCluster() throws Exception {
System.setProperty("metricsEnabled", "true");
+ // BaseHttpClusterStateProvider has a background job that pre-fetches data from CLUSTERSTATUS
+ // on timed intervals. This can pollute this test, so we set the interval very high to
+ // prevent it from running.
+ System.setProperty(SYS_PROP_CACHE_TIMEOUT_SECONDS, "" + Integer.MAX_VALUE);
configureCluster(NODE_COUNT)
.addConfig(
"conf",
@@ -296,14 +300,9 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
// admin endpoint. Too many calls to CLUSTERSTATUS might mean insufficient caching and
// performance regressions!
- // BaseHttpClusterStateProvider has a background job that pre-fetches data from CLUSTERSTATUS
- // on timed intervals. This can pollute this test, so we set the interval very high to
- // prevent it from running.
- System.setProperty(SYS_PROP_CACHE_TIMEOUT_SECONDS, "" + Integer.MAX_VALUE);
-
String collectionName = "HTTPCSPTEST";
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1)
- .process(cluster.getSolrClient());
+ .process(getRandomClient());
cluster.waitForActiveCollection(collectionName, 2, 2);
try (LogListener adminLogs = LogListener.info(HttpSolrCall.class).substring("[admin]");
@@ -342,6 +341,9 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
assertEquals(2, adminLogs.getCount());
}
}
+
+ // Clean up the collection to allow test iterations to succeed
+ CollectionAdminRequest.deleteCollection(collectionName).process(getRandomClient());
}
private CloudSolrClient createHttpCSPBasedCloudSolrClient() {