solr icon indicating copy to clipboard operation
solr copied to clipboard

SOLR-18026 Fix failing test TestSolrCLIRunExample on java25

Open janhoy opened this issue 4 weeks ago • 1 comments

Spent 1/2 hour with Claude on this, and it all makes sense.

Root Cause

The SOLR-15442 commit (which synchronized port and host variable naming) made an incomplete update:

  1. What changed in SOLR-15442:
    • Renamed jetty.port → solr.port.listen
    • Renamed host → solr.host.advertise
    • Updated solr.xml to use ${solr.host.advertise:} instead of ${host:}
  2. The bug:
    • TestSolrCLIRunExample.java was updated to use solr.port.listen ✅
    • But it still used the deprecated host property instead of solr.host.advertise
    • TestHarness.java also still used the old host property ❌
  3. Why it failed:
    • The test sets System.setProperty("host", "localhost") after EnvUtils initialization
    • The deprecated property mapping only runs during static initialization
    • So solr.host.advertise remained unset
    • Solr nodes couldn't register properly in ZooKeeper
    • Result: "No live SolrServers available to handle this request"

Files Fixed

  1. TestSolrCLIRunExample.java (lines 127, 215, and JavaDoc):
    • Changed System.setProperty("host", "localhost")
    • To System.setProperty("solr.host.advertise", "localhost")
  2. TestHarness.java (line 191):
    • Changed System.getProperty("host")
    • To System.getProperty("solr.host.advertise")

https://issues.apache.org/jira/browse/SOLR-18026

Other tests could also be at risk if they MODIFY the deprecated variant, and it is read by Solr with the new name.

janhoy avatar Dec 11 '25 23:12 janhoy

The unrelated precommit failure is due to a commit on SOLR-17928 yesterday, I left a note there...

janhoy avatar Dec 12 '25 01:12 janhoy