Skip to content

Commit 31ac7ae

Browse files
authored
SOLR-18026 Fix failing test TestSolrCLIRunExample on java25 (#3944)
1 parent 7e7c9cf commit 31ac7ae

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ public static void beforeClass() {
6969
}
7070

7171
@AfterClass
72-
public static void cleanupDirectoryFactory() {
72+
public static void cleanup() {
7373
System.clearProperty("solr.directoryFactory");
74+
System.clearProperty("solr.host.advertise");
75+
System.clearProperty("solr.port.listen");
76+
System.clearProperty("solr.log.dir");
7477
}
7578

7679
/**
@@ -124,7 +127,7 @@ public int execute(org.apache.commons.exec.CommandLine cmd) throws IOException {
124127
if (solrCloudCluster == null) {
125128
Path logDir = createTempDir("solr_logs");
126129
System.setProperty("solr.log.dir", logDir.toString());
127-
System.setProperty("host", "localhost");
130+
System.setProperty("solr.host.advertise", "localhost");
128131
System.setProperty("solr.port.listen", String.valueOf(port));
129132
solrCloudCluster = new MiniSolrCloudCluster(1, createTempDir(), solrxml, jettyConfig);
130133
} else {
@@ -212,7 +215,7 @@ protected int startStandaloneSolr(String[] args) {
212215

213216
Path solrHomeDir = Path.of(getArg("--solr-home", args));
214217

215-
System.setProperty("host", "localhost");
218+
System.setProperty("solr.host.advertise", "localhost");
216219
System.setProperty("solr.port.listen", String.valueOf(port));
217220
System.setProperty("solr.logs.dir", createTempDir("solr_logs").toString());
218221

@@ -418,9 +421,9 @@ protected void testExample(String exampleName) throws Exception {
418421

419422
/**
420423
* Tests the interactive SolrCloud example; we cannot test the non-interactive because we need
421-
* control over the port and can only test with one node since the test relies on setting the host
422-
* and solr.port.listen system properties, i.e. there is no test coverage for the --no-prompt
423-
* option.
424+
* control over the port and can only test with one node since the test relies on setting the
425+
* solr.host.advertise and solr.port.listen system properties, i.e. there is no test coverage for
426+
* the --no-prompt option.
424427
*/
425428
@Test
426429
public void testInteractiveSolrCloudExample() throws Exception {

solr/test-framework/src/java/org/apache/solr/util/TestHarness.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public static NodeConfig buildTestNodeConfig(Path solrHome) {
188188
(null == System.getProperty("zkHost"))
189189
? null
190190
: new CloudConfig.CloudConfigBuilder(
191-
System.getProperty("host"), Integer.getInteger("hostPort", 8983))
191+
System.getProperty("solr.host.advertise"), Integer.getInteger("hostPort", 8983))
192192
.setZkClientTimeout(SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT)
193193
.setZkHost(System.getProperty("zkHost"))
194194
.build();

0 commit comments

Comments
 (0)