Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
205ef9a
the 4 bats that need fixes
jaykay12 Oct 22, 2026
c8ce02c
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 22, 2026
68d4040
fixed post bats
jaykay12 Oct 22, 2026
71c7457
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 22, 2026
65dcfa1
few changes
jaykay12 Oct 22, 2026
f996536
checks
jaykay12 Oct 22, 2026
458e920
changes
jaykay12 Oct 22, 2026
6da4ab2
3 bats corrected
jaykay12 Oct 22, 2026
594b5b3
changes
jaykay12 Oct 22, 2026
4817af8
fix helps bat
jaykay12 Oct 23, 2026
d39804f
fixed all bats
jaykay12 Oct 23, 2026
28beecb
enabled all
jaykay12 Oct 23, 2026
681677a
regenrated
jaykay12 Oct 23, 2026
193756d
tidy
jaykay12 Oct 23, 2026
a0071f0
enabling all bats for picoCLI
jaykay12 Oct 23, 2026
4d7faad
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 23, 2026
e3e6db5
minor tweaks
jaykay12 Oct 23, 2026
ed39884
more strict checks
jaykay12 Oct 23, 2026
bbf4922
fix
jaykay12 Oct 23, 2026
d442324
helper for shared util
jaykay12 Oct 23, 2026
ccd96d8
comment rephrased - ai review
jaykay12 Oct 23, 2026
b5314f5
cl added
jaykay12 Oct 23, 2026
4cf5ad5
unintentional changes
jaykay12 Oct 23, 2026
8679d8d
cl proper
jaykay12 Oct 23, 2026
7eb288a
cl final
jaykay12 Oct 23, 2026
dc61d00
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 26, 2026
1fa1472
pr comments
jaykay12 Oct 26, 2026
1af8443
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 26, 2026
9f1df2c
Fix comment formatting in bats_helper.bash
jaykay12 Oct 26, 2026
40a85dd
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 29, 2026
adc8ba0
Merge branch 'main' into SOLR-18566-picocli-bats-fixed
jaykay12 Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: >
All BATs Integration Tests now run against the picocli CLI
type: fixed
authors:
- name: Jalaz Kumar
nick: jaykay12
links:
- name: SOLR-18566
url: https://issues.apache.org/jira/browse/SOLR-18566

2 changes: 2 additions & 0 deletions solr/core/src/java/org/apache/solr/cli/AuthTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ record AuthParams(
names = {"--solr-include-file"},
paramLabel = "FILE",
required = true,
// Supplied by bin/solr from SOLR_INCLUDE; hidden since a user-supplied duplicate is rejected.
hidden = true,
description =
"The Solr include file which contains overridable environment variables for configuring Solr configurations. Defaults to solr.in.sh or solr.in.cmd.")
private String solrIncludeFile;
Expand Down
20 changes: 0 additions & 20 deletions solr/packaging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -347,29 +347,9 @@ task integrationTests(type: BatsTask) {
configureBatsTask(it, 'test-output', false)
}

// The same suites run against the experimental picocli CLI. Deliberately a curated list rather
// than the whole suite, so the run stays short. A change that ports another tool to picocli
// should add that tool's .bats file here.
task integrationTestsPicocli(type: BatsTask) {
description = 'Runs the BATS suites for the migrated commands against the experimental picocli CLI.'
configureBatsTask(it, 'test-output-picocli', true)
// A suite belongs here only when every command it invokes has been migrated, not merely the
// command under test. test_auth.bats, for example, uses `solr assert` to wait for startup, so
// it cannot join until the assert command is migrated. test_help.bats asserts the exact wording
// of the commons-cli help output, which the picocli implementation words differently.
testFiles = [
'test/test_version.bats',
'test/test_status.bats',
'test/test_create.bats',
'test/test_delete_collection.bats',
'test/test_zk.bats',
'test/test_auth.bats',
'test/test_modules.bats',
'test/test_security_manager.bats',
'test/test_healthcheck.bats',
'test/test_postlogs.bats',
'test/test_extraction.bats',
]
}

abstract class BatsTask extends Exec {
Expand Down
10 changes: 10 additions & 0 deletions solr/packaging/test/bats_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ wait_for() {

return 1 # Timeout reached
}

# Utility function for asserting between the commons-cli wording ($1), or, when running against the picocli CLI, the picocli wording ($2)
# TODO: Remove this once commons-cli cleanup happens
assert_output_for_cli() {
if [ -n "${SOLR_PICOCLI:-}" ]; then
assert_output --partial "$2"
else
assert_output --partial "$1"
fi
}
4 changes: 2 additions & 2 deletions solr/packaging/test/test_basic_auth.bats
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ setup() {

# The auth command exports some system variables that are injected as basic auth username and password,
# however that defeats our test so fake that out via --solr-include-file param specifing a bogus path.
solr auth enable --type basicAuth --credentials name:password --solr-include-file /force/credentials/to/be/supplied
SOLR_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the way to pass this setting in is via a system property, that maybe begs teh question why do we have the parameter at all?

@jaykay12 jaykay12 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not fully sure about this aspect as of now. will have to dig little deeper here.


solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000
}
Expand Down Expand Up @@ -74,7 +74,7 @@ run solr create -c COLL_NAME
assert_output --partial '1 files indexed.'

# Test postlogs
run solr postlogs -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME -rootdir ${SOLR_LOGS_DIR}/solr.log
run solr postlogs -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME --rootdir ${SOLR_LOGS_DIR}/solr.log
assert_output --partial 'Committed'

# Test export
Expand Down
17 changes: 9 additions & 8 deletions solr/packaging/test/test_help.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,39 @@ setup() {

@test "solr help flag prints help" {
run -1 solr --help
assert_output --partial 'Usage: solr COMMAND OPTIONS'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know we are doing "the right thing", but a part of me just wishes we removed the commons-cli testing at this point... but this is "the right way"...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is to facilitate a smoother migration.
+1 this feels like the right way, once we ensure stablity of picocli, this all goes away then.

assert_output_for_cli 'Usage: solr COMMAND OPTIONS' 'usage: bin/solr'
refute_output --partial 'ERROR'
}
@test "solr with no flags prints help" {
run -1 solr
assert_output --partial 'Usage: solr COMMAND OPTIONS'
assert_output_for_cli 'Usage: solr COMMAND OPTIONS' 'usage: bin/solr'
refute_output --partial 'ERROR'
}

@test "start help flag prints help" {
run solr start --help
assert_output --partial 'Usage: solr start'
assert_output_for_cli 'Usage: solr start' 'usage: bin/solr start'
refute_output --partial 'ERROR'
}

@test "start h flag prints help" {
run solr start -h
assert_output --partial 'Usage: solr start'
assert_output_for_cli 'Usage: solr start' 'usage: bin/solr start'
refute_output --partial 'ERROR: Hostname is required when using the -h option!'
}



@test "stop help flag prints help" {
run solr stop --help
assert_output --partial 'Usage: solr stop'
assert_output_for_cli 'Usage: solr stop' 'usage: bin/solr stop'
refute_output --partial 'ERROR'
}

@test "restart help flag prints help" {
[ -z "${SOLR_PICOCLI:-}" ] || skip "restart is not migrated to picocli yet"
run solr restart --help
assert_output --partial 'Usage: solr restart'
assert_output_for_cli 'Usage: solr restart' 'usage: bin/solr restart'
refute_output --partial 'ERROR'
}

Expand Down Expand Up @@ -85,13 +86,13 @@ setup() {
@test "zk help flag prints help" {
run solr zk --help
assert_output --partial 'usage:'
assert_output --partial 'bin/solr zk ls'
assert_output_for_cli 'bin/solr zk ls' 'usage: bin/solr zk'
refute_output --partial 'ERROR'
}

@test "auth help flag prints help" {
run solr auth --help
assert_output --partial 'bin/solr auth enable'
assert_output_for_cli 'bin/solr auth enable' 'usage: bin/solr auth'
refute_output --partial 'ERROR'
}

Expand Down
2 changes: 1 addition & 1 deletion solr/packaging/test/test_post.bats
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ teardown() {
@test "Check help command" {

run solr post
assert_output --partial 'Missing required option: c'
assert_output_for_cli "Missing required option: c" "Missing required option: '--name=name'"

run solr post -h
assert_output --partial 'usage: bin/solr post'
Expand Down
4 changes: 2 additions & 2 deletions solr/packaging/test/test_stream.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ load bats_helper

setup_file() {
common_clean_setup
solr start -e techproducts
solr auth enable --type basicAuth --credentials name:password --solr-include-file /force/credentials/to/be/supplied
solr start -e techproducts --solr-home "${SOLR_HOME}"
SOLR_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password
}

teardown_file() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ See xref:cli/index.adoc[] to enable this implementation and for its known limita

....
bin/solr auth [-hv] --auth-conf-dir=DIR [--block-unknown=true|false]
[--prompt=true|false] [-s=<solrConnection>] --solr-include-file=FILE
[--solr-url=<solrUrl>] [--type=TYPE] [-u=<credentials>]
[--prompt=true|false] [-s=<solrConnection>] [--solr-url=<solrUrl>]
[--type=TYPE] [-u=<credentials>]
[--update-include-file-only=true|false] [-z=<zkHost>] enable|disable
....

Expand Down Expand Up @@ -66,9 +66,6 @@ Updates or enables/disables authentication. Must be run on the Solr server itsel
*-s*, *--solr-connection*=_<solrConnection>_::
Zookeeper or HTTP(s) connection string; unnecessary if SOLR_CONNECTION is defined in solr.in.sh; otherwise, defaults to localhost:9983.

*--solr-include-file*=_FILE_::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we just keep this? Or is this just a property that no one uses, so we simplifeid by making it a system property?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not fully confident on this aspect, will try digging more here.

*(required)* The Solr include file which contains overridable environment variables for configuring Solr configurations. Defaults to solr.in.sh or solr.in.cmd.

*--solr-url*=_<solrUrl>_::
Base Solr URL, which can be used to determine the zk-host if --zk-host is not known

Expand Down
Loading