dsmiley opened a new pull request, #5280: URL: https://github.com/apache/solr/pull/5280
🤖 `TestSolrCLIRunExample.testSolrCloudExampleWithScriptInputs` failed on a busy CI worker with a misleading "collection not found" error, and the cause was in the tool, not only the test. **Failure chain** 1. The test picks a free port by opening and closing a `ServerSocket(0)`. 2. Before `RunExampleTool` probes it, another process takes that port. This is a race that only shows on a busy machine, such as a 96-core CI worker. 3. The tool prints "port N is already being used" and re-prompts. 4. `--script-inputs` is a fixed ordered list, so the retry consumes the next scripted answers (the collection name, then `numShards`) as ports. 5. `isPortAvailable(2)` hits the test security policy's `SocketPermission` denial, the tool aborts with exit 1, and Solr never starts. 6. The test ignored the exit code, so it failed later with "collection not found", hiding the real error. **Changes** - `RunExampleTool`: with `--script-inputs`, a port that is already in use now throws immediately with a clear message. A retry can't recover, since it would read the next scripted value. - `TestSolrCLIRunExample`: `testSolrCloudExampleWithScriptInputs` asserts the tool's exit code, so a failure shows the tool's error. A new `testScriptInputsPortInUse` holds a port open and expects exit code 1. **Not changed** The test still picks a port, releases it, and uses it later, so it can still lose that race. It now fails with a clear message. The `failExecuteScript` access-denied output in the same log comes from the unrelated `testFailExecuteScript`, which expects it. **Testing** `gradlew :solr:core:test --tests "org.apache.solr.cli.TestSolrCLIRunExample"` passes (7 tests). **Related** - #4663 (moves `RunExampleTool` and the test into sub-packages) and #5063 (touches `RunExampleTool`) overlap these files, so whichever merges second needs a rebase. - SOLR-8545 (open, "TestSolrCLIRunExample is failing a lot on the jenkins cluster") may be related. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
