Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-18026 Fix failing test TestSolrCLIRunExample on java25 (#3944)

Jan Høydahl31ac7ae3d63c
diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
index 55a70326e87..653adb6d74e 100644
--- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
+++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
@@ -69,8 +69,11 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
}
@AfterClass
- public static void cleanupDirectoryFactory() {
+ public static void cleanup() {
System.clearProperty("solr.directoryFactory");
+ System.clearProperty("solr.host.advertise");
+ System.clearProperty("solr.port.listen");
+ System.clearProperty("solr.log.dir");
}
/**
@@ -124,7 +127,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
if (solrCloudCluster == null) {
Path logDir = createTempDir("solr_logs");
System.setProperty("solr.log.dir", logDir.toString());
- System.setProperty("host", "localhost");
+ System.setProperty("solr.host.advertise", "localhost");
System.setProperty("solr.port.listen", String.valueOf(port));
solrCloudCluster = new MiniSolrCloudCluster(1, createTempDir(), solrxml, jettyConfig);
} else {
@@ -212,7 +215,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
Path solrHomeDir = Path.of(getArg("--solr-home", args));
- System.setProperty("host", "localhost");
+ System.setProperty("solr.host.advertise", "localhost");
System.setProperty("solr.port.listen", String.valueOf(port));
System.setProperty("solr.logs.dir", createTempDir("solr_logs").toString());
@@ -418,9 +421,9 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
/**
* Tests the interactive SolrCloud example; we cannot test the non-interactive because we need
- * control over the port and can only test with one node since the test relies on setting the host
- * and solr.port.listen system properties, i.e. there is no test coverage for the --no-prompt
- * option.
+ * control over the port and can only test with one node since the test relies on setting the
+ * solr.host.advertise and solr.port.listen system properties, i.e. there is no test coverage for
+ * the --no-prompt option.
*/
@Test
public void testInteractiveSolrCloudExample() throws Exception {
diff --git a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
index 300aa7c3185..de02f1b2ccf 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
@@ -188,7 +188,7 @@ public class TestHarness extends BaseTestHarness {
(null == System.getProperty("zkHost"))
? null
: new CloudConfig.CloudConfigBuilder(
- System.getProperty("host"), Integer.getInteger("hostPort", 8983))
+ System.getProperty("solr.host.advertise"), Integer.getInteger("hostPort", 8983))
.setZkClientTimeout(SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT)
.setZkHost(System.getProperty("zkHost"))
.build();