From 205ef9a29a9aed39d57d8377a36050ff4eb6134a Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Thu, 22 Oct 2026 15:11:47 +0530 Subject: [PATCH 01/24] the 4 bats that need fixes --- solr/packaging/build.gradle | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index dedb2783018c..9de402d8271b 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -358,17 +358,10 @@ task integrationTestsPicocli(type: BatsTask) { // 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', + 'test/test_basic_auth.bats', + 'test/test_help.bats', + 'test/test_post.bats', + 'test/test_stream.bats' ] } From 68d40409b32cb6c634151e78272df0d61018c38f Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Thu, 22 Oct 2026 19:30:00 +0530 Subject: [PATCH 02/24] fixed post bats --- solr/packaging/test/test_post.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.bats index 3c90e7d14513..070e70dd65e0 100644 --- a/solr/packaging/test/test_post.bats +++ b/solr/packaging/test/test_post.bats @@ -39,7 +39,7 @@ teardown() { @test "Check help command" { run solr post - assert_output --partial 'Missing required option: c' + assert_output --partial 'Missing required option' run solr post -h assert_output --partial 'usage: bin/solr post' From 65dcfa139e6a8403b44e066b7c706e9a5c16be20 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 02:43:58 +0530 Subject: [PATCH 03/24] few changes --- .../java/org/apache/solr/cli/AuthTool.java | 2 ++ solr/packaging/test/test_basic_auth.bats | 29 +++++++++---------- solr/packaging/test/test_stream.bats | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index b63a0d545ddf..7beac17859b2 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -177,6 +177,8 @@ record AuthParams( names = {"--solr-include-file"}, paramLabel = "FILE", required = true, + // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping it out of help + 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; diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.bats index ab4932a7f5a1..3903fd4bb0d9 100644 --- a/solr/packaging/test/test_basic_auth.bats +++ b/solr/packaging/test/test_basic_auth.bats @@ -19,14 +19,13 @@ load bats_helper setup() { common_clean_setup - + echo "Starting Solr" solr start -Dsolr.packages.enabled=true - - # 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 - + + # The auth command exports some system variables that are injected as basic auth username and password, + solr auth enable --type basicAuth --credentials name:password + solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000 } @@ -45,28 +44,28 @@ teardown() { @test "create, config, api, and delete with basic auth" { # Test create - run solr create -u name:password -c COLL_NAME + run solr create -u name:password -c COLL_NAME assert_output --partial "Created collection 'COLL_NAME'" - + # Test config run solr config -u name:password -c COLL_NAME --action set-property --property updateHandler.autoCommit.maxDocs --value 100 --solr-url http://localhost:${SOLR_PORT}/solr assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100" - + # Test api run solr api -u name:password --solr-url "http://localhost:${SOLR_PORT}/solr/COLL_NAME/select?q=*:*" --verbose assert_output --partial '"numFound":0' - + # Test delete run solr delete --credentials name:password -c COLL_NAME -z localhost:${ZK_PORT} --delete-config --verbose assert_output --partial "Deleted collection 'COLL_NAME'" refute collection_exists "COLL_NAME" refute config_exists "COLL_NAME" - + } @test "post, postlogs and export with basic auth" { run solr create -c COLL_NAME - run solr create -u name:password -c COLL_NAME + run solr create -u name:password -c COLL_NAME assert_output --partial "Created collection 'COLL_NAME'" # Test post @@ -76,15 +75,15 @@ run solr create -c COLL_NAME # Test postlogs 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 #run solr export -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME --query "*:*" --output "${BATS_TEST_TMPDIR}/output" #assert_output --partial 'Export complete' - + } @test "package with basic auth" { - + run solr package deploy PACKAGE_NAME --credentials name:password --collections foo-1.2 # verify that package tool is communicating with Solr via basic auth assert_output --partial "Collection(s) doesn't exist: [foo-1.2]" diff --git a/solr/packaging/test/test_stream.bats b/solr/packaging/test/test_stream.bats index b1a9a27c7cca..e1cdca25ae75 100644 --- a/solr/packaging/test/test_stream.bats +++ b/solr/packaging/test/test_stream.bats @@ -20,7 +20,7 @@ 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 auth enable --type basicAuth --credentials name:password } teardown_file() { From f996536357fbe185f5af917aa4140e11eeb86d98 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 02:57:55 +0530 Subject: [PATCH 04/24] checks --- solr/packaging/build.gradle | 6 +++--- solr/packaging/test/test_basic_auth.bats | 2 +- solr/packaging/test/test_stream.bats | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index 9de402d8271b..e67ca97e3157 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -359,9 +359,9 @@ task integrationTestsPicocli(type: BatsTask) { // of the commons-cli help output, which the picocli implementation words differently. testFiles = [ 'test/test_basic_auth.bats', - 'test/test_help.bats', - 'test/test_post.bats', - 'test/test_stream.bats' +// 'test/test_help.bats', +// 'test/test_post.bats', +// 'test/test_stream.bats' ] } diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.bats index 3903fd4bb0d9..9ce0935c1d72 100644 --- a/solr/packaging/test/test_basic_auth.bats +++ b/solr/packaging/test/test_basic_auth.bats @@ -24,7 +24,7 @@ setup() { solr start -Dsolr.packages.enabled=true # The auth command exports some system variables that are injected as basic auth username and password, - solr auth enable --type basicAuth --credentials name:password + SOLR_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000 } diff --git a/solr/packaging/test/test_stream.bats b/solr/packaging/test/test_stream.bats index e1cdca25ae75..38746b56c1bd 100644 --- a/solr/packaging/test/test_stream.bats +++ b/solr/packaging/test/test_stream.bats @@ -20,7 +20,7 @@ load bats_helper setup_file() { common_clean_setup solr start -e techproducts - solr auth enable --type basicAuth --credentials name:password + SOLR_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password } teardown_file() { From 458e9202b6fa3320b71288d20efb2db3db26bc5a Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 03:18:45 +0530 Subject: [PATCH 05/24] changes --- solr/packaging/test/test_basic_auth.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.bats index 9ce0935c1d72..5d9240cc2c2f 100644 --- a/solr/packaging/test/test_basic_auth.bats +++ b/solr/packaging/test/test_basic_auth.bats @@ -73,7 +73,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 From 6da4ab20b788b5788686bbe1ecfd11e839c31df6 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 03:48:37 +0530 Subject: [PATCH 06/24] 3 bats corrected --- solr/packaging/build.gradle | 4 ++-- solr/packaging/test/test_basic_auth.bats | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index e67ca97e3157..4d34ca158dcd 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -360,8 +360,8 @@ task integrationTestsPicocli(type: BatsTask) { testFiles = [ 'test/test_basic_auth.bats', // 'test/test_help.bats', -// 'test/test_post.bats', -// 'test/test_stream.bats' + 'test/test_post.bats', + 'test/test_stream.bats' ] } diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.bats index 5d9240cc2c2f..313514d71fe2 100644 --- a/solr/packaging/test/test_basic_auth.bats +++ b/solr/packaging/test/test_basic_auth.bats @@ -24,6 +24,7 @@ setup() { solr start -Dsolr.packages.enabled=true # 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_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000 From 594b5b333b8028f35a5576c6884f2d05ec4fbb86 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 03:54:33 +0530 Subject: [PATCH 07/24] changes --- solr/packaging/test/test_stream.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/packaging/test/test_stream.bats b/solr/packaging/test/test_stream.bats index 38746b56c1bd..fd0a5201169a 100644 --- a/solr/packaging/test/test_stream.bats +++ b/solr/packaging/test/test_stream.bats @@ -19,7 +19,7 @@ load bats_helper setup_file() { common_clean_setup - solr start -e techproducts + solr start -e techproducts --solr-home "${SOLR_HOME}" SOLR_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password } From 4817af86373a4ea1085f7b20e3cdf55eea702c74 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 11:39:32 +0530 Subject: [PATCH 08/24] fix helps bat --- solr/packaging/test/test_help.bats | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.bats index 54bab9fe85bc..3b51fe38fbc1 100644 --- a/solr/packaging/test/test_help.bats +++ b/solr/packaging/test/test_help.bats @@ -23,24 +23,24 @@ setup() { @test "solr help flag prints help" { run -1 solr --help - assert_output --partial 'Usage: solr COMMAND OPTIONS' + assert_output --regexp '[Uu]sage: (solr COMMAND OPTIONS|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 --regexp '[Uu]sage: (solr COMMAND OPTIONS|bin/solr)' refute_output --partial 'ERROR' } @test "start help flag prints help" { run solr start --help - assert_output --partial 'Usage: solr start' + assert_output --regexp '[Uu]sage: (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 --regexp '[Uu]sage: (bin/)?solr start' refute_output --partial 'ERROR: Hostname is required when using the -h option!' } @@ -48,13 +48,14 @@ setup() { @test "stop help flag prints help" { run solr stop --help - assert_output --partial 'Usage: solr stop' + assert_output --regexp '[Uu]sage: (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 --regexp '[Uu]sage: (bin/)?solr restart' refute_output --partial 'ERROR' } From d39804fc5eadb10c73dbd5cc62b19a4a05f0721b Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 11:42:55 +0530 Subject: [PATCH 09/24] fixed all bats --- solr/packaging/build.gradle | 8 ++++---- solr/packaging/test/test_help.bats | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index 4d34ca158dcd..175489b32528 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -358,10 +358,10 @@ task integrationTestsPicocli(type: BatsTask) { // 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_basic_auth.bats', -// 'test/test_help.bats', - 'test/test_post.bats', - 'test/test_stream.bats' +// 'test/test_basic_auth.bats', + 'test/test_help.bats', +// 'test/test_post.bats', +// 'test/test_stream.bats' ] } diff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.bats index 3b51fe38fbc1..7dd328f7824c 100644 --- a/solr/packaging/test/test_help.bats +++ b/solr/packaging/test/test_help.bats @@ -86,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 --regexp '(bin/solr zk ls| ls)' refute_output --partial 'ERROR' } @test "auth help flag prints help" { run solr auth --help - assert_output --partial 'bin/solr auth enable' + assert_output --regexp '(bin/solr auth enable|enable\|disable)' refute_output --partial 'ERROR' } From 28beecb69b2e4431dbc5d1cdff603b5544d9618c Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 12:02:48 +0530 Subject: [PATCH 10/24] enabled all --- solr/packaging/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index 175489b32528..9de402d8271b 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -358,10 +358,10 @@ task integrationTestsPicocli(type: BatsTask) { // 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_basic_auth.bats', + 'test/test_basic_auth.bats', 'test/test_help.bats', -// 'test/test_post.bats', -// 'test/test_stream.bats' + 'test/test_post.bats', + 'test/test_stream.bats' ] } From 681677a01d14d2aa0cbb47fc7d572ede296fa5dc Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 13:17:56 +0530 Subject: [PATCH 11/24] regenrated --- solr/core/src/java/org/apache/solr/cli/AuthTool.java | 2 +- .../modules/deployment-guide/pages/cli/solr-auth.adoc | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index 7beac17859b2..126fd5608bb8 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -177,7 +177,7 @@ record AuthParams( names = {"--solr-include-file"}, paramLabel = "FILE", required = true, - // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping it out of help + // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping this out of help 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.") diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/cli/solr-auth.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/cli/solr-auth.adoc index 31a64352cf57..7a7ceb3484ee 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/cli/solr-auth.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/cli/solr-auth.adoc @@ -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=] --solr-include-file=FILE - [--solr-url=] [--type=TYPE] [-u=] + [--prompt=true|false] [-s=] [--solr-url=] + [--type=TYPE] [-u=] [--update-include-file-only=true|false] [-z=] enable|disable .... @@ -66,9 +66,6 @@ Updates or enables/disables authentication. Must be run on the Solr server itsel *-s*, *--solr-connection*=__:: 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_:: - *(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*=__:: Base Solr URL, which can be used to determine the zk-host if --zk-host is not known From 193756dceffc3a4eb449abfc220319ea7fb371a4 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 13:26:11 +0530 Subject: [PATCH 12/24] tidy --- solr/core/src/java/org/apache/solr/cli/AuthTool.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index 126fd5608bb8..6d04e6723809 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -177,7 +177,8 @@ record AuthParams( names = {"--solr-include-file"}, paramLabel = "FILE", required = true, - // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping this out of help + // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping this out of + // help 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.") From a0071f033ed0b045807e001eadcd8ad6e8efd0b7 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 13:32:03 +0530 Subject: [PATCH 13/24] enabling all bats for picoCLI --- solr/packaging/build.gradle | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index 9de402d8271b..8333708964a1 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -353,16 +353,6 @@ task integrationTests(type: BatsTask) { 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_basic_auth.bats', - 'test/test_help.bats', - 'test/test_post.bats', - 'test/test_stream.bats' - ] } abstract class BatsTask extends Exec { From e3e6db502df2ca9222e92a61424cff994b8cb75e Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 14:14:52 +0530 Subject: [PATCH 14/24] minor tweaks --- solr/packaging/build.gradle | 3 --- solr/packaging/test/test_help.bats | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle index 8333708964a1..23cfa089997e 100644 --- a/solr/packaging/build.gradle +++ b/solr/packaging/build.gradle @@ -347,9 +347,6 @@ 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) diff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.bats index 7dd328f7824c..51a483db8200 100644 --- a/solr/packaging/test/test_help.bats +++ b/solr/packaging/test/test_help.bats @@ -53,7 +53,7 @@ setup() { } @test "restart help flag prints help" { -[ -z "$SOLR_PICOCLI" ] || skip "restart is not migrated to picocli yet" +[ -z "${SOLR_PICOCLI:-}" ] || skip "restart is not migrated to picocli yet" run solr restart --help assert_output --regexp '[Uu]sage: (bin/)?solr restart' refute_output --partial 'ERROR' From ed398849cef0f15e9ed8f1f0a4c2f27fd9e1ded2 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 14:22:11 +0530 Subject: [PATCH 15/24] more strict checks --- solr/packaging/test/test_post.bats | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.bats index 070e70dd65e0..60c9c1db4dd4 100644 --- a/solr/packaging/test/test_post.bats +++ b/solr/packaging/test/test_post.bats @@ -39,7 +39,11 @@ teardown() { @test "Check help command" { run solr post - assert_output --partial 'Missing required option' + if [ -n "${SOLR_PICOCLI:-}" ]; then + assert_output --partial "Missing required option: '--name='" + else + assert_output --partial 'Missing required option: c' + fi run solr post -h assert_output --partial 'usage: bin/solr post' From bbf4922e50c9f10d3f850680b135d5d18217b0d2 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 14:30:00 +0530 Subject: [PATCH 16/24] fix --- solr/packaging/test/test_post.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.bats index 60c9c1db4dd4..ca72f4f2d187 100644 --- a/solr/packaging/test/test_post.bats +++ b/solr/packaging/test/test_post.bats @@ -40,7 +40,7 @@ teardown() { run solr post if [ -n "${SOLR_PICOCLI:-}" ]; then - assert_output --partial "Missing required option: '--name='" + assert_output --partial "Missing required option: '--name=name'" else assert_output --partial 'Missing required option: c' fi From d4423243d4da7921188922102ea0c0ee81436db7 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 14:51:46 +0530 Subject: [PATCH 17/24] helper for shared util --- solr/packaging/test/bats_helper.bash | 16 +++++++++++++--- solr/packaging/test/test_help.bats | 18 +++++++++--------- solr/packaging/test/test_post.bats | 6 +----- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/solr/packaging/test/bats_helper.bash b/solr/packaging/test/bats_helper.bash index d684724a2e5e..4edb7f24685d 100644 --- a/solr/packaging/test/bats_helper.bash +++ b/solr/packaging/test/bats_helper.bash @@ -103,15 +103,25 @@ wait_for() { local interval="${2:-1}" # Default 1 second between retries shift 2 # Remove timeout and interval from args local command=("$@") # Remaining args are the command to execute - + local end_time=$(($(date +%s) + timeout)) - + while [ $(date +%s) -lt $end_time ]; do if "${command[@]}"; then return 0 fi sleep "$interval" done - + 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 +} diff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.bats index 51a483db8200..fe426d752c52 100644 --- a/solr/packaging/test/test_help.bats +++ b/solr/packaging/test/test_help.bats @@ -23,24 +23,24 @@ setup() { @test "solr help flag prints help" { run -1 solr --help - assert_output --regexp '[Uu]sage: (solr COMMAND OPTIONS|bin/solr)' + 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 --regexp '[Uu]sage: (solr COMMAND OPTIONS|bin/solr)' + 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 --regexp '[Uu]sage: (bin/)?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 --regexp '[Uu]sage: (bin/)?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!' } @@ -48,14 +48,14 @@ setup() { @test "stop help flag prints help" { run solr stop --help - assert_output --regexp '[Uu]sage: (bin/)?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" + [ -z "${SOLR_PICOCLI:-}" ] || skip "restart is not migrated to picocli yet" run solr restart --help - assert_output --regexp '[Uu]sage: (bin/)?solr restart' + assert_output_for_cli 'Usage: solr restart' 'usage: bin/solr restart' refute_output --partial 'ERROR' } @@ -86,13 +86,13 @@ setup() { @test "zk help flag prints help" { run solr zk --help assert_output --partial 'usage:' - assert_output --regexp '(bin/solr zk ls| 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 --regexp '(bin/solr auth enable|enable\|disable)' + assert_output_for_cli 'bin/solr auth enable' 'usage: bin/solr auth' refute_output --partial 'ERROR' } diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.bats index ca72f4f2d187..7306044da60b 100644 --- a/solr/packaging/test/test_post.bats +++ b/solr/packaging/test/test_post.bats @@ -39,11 +39,7 @@ teardown() { @test "Check help command" { run solr post - if [ -n "${SOLR_PICOCLI:-}" ]; then - assert_output --partial "Missing required option: '--name=name'" - else - assert_output --partial 'Missing required option: c' - fi + assert_output_for_cli "Missing required option: c" "Missing required option: '--name=name'" run solr post -h assert_output --partial 'usage: bin/solr post' From ccd96d8d93131ccec3fff9f3d394029299b2e020 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 14:58:29 +0530 Subject: [PATCH 18/24] comment rephrased - ai review --- solr/core/src/java/org/apache/solr/cli/AuthTool.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index 6d04e6723809..edc3f4f0535d 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -177,8 +177,8 @@ record AuthParams( names = {"--solr-include-file"}, paramLabel = "FILE", required = true, - // bin/solr always supplies this; PicoCLI doesn't allow duplicate entries, keeping this out of - // help + // Always supplied by bin/solr (from SOLR_INCLUDE); hidden because a user-supplied copy would + // be a duplicate, which picocli rejects. 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.") From b5314f5a56bd166dc40959e3e959117a4a18b4d8 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 15:02:16 +0530 Subject: [PATCH 19/24] cl added --- changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml b/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml index 7e873f5c312b..7a535be4f2f3 100644 --- a/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml +++ b/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml @@ -1,10 +1,14 @@ title: > The SOLR_CONNECTION environment variable (solr.connection system property) is now honored by the - bin/solr commands as documented. + bin/solr commands as documented. Fixed Integration Tests(BATs) for PicoCLI cutover. type: fixed authors: - name: Jan Høydahl nick: janhoy + - name: Jalaz Kumar + nick: jaykay12 links: - name: PR#5054 url: https://github.com/apache/solr/pull/5054 + - name: PR#5204 + url: https://github.com/apache/solr/pull/5204 From 4cf5ad50f0ad6135b43c70153bc000add0b89e17 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 15:12:28 +0530 Subject: [PATCH 20/24] unintentional changes --- solr/packaging/test/bats_helper.bash | 6 +++--- solr/packaging/test/test_basic_auth.bats | 26 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/solr/packaging/test/bats_helper.bash b/solr/packaging/test/bats_helper.bash index 4edb7f24685d..e24ec0193512 100644 --- a/solr/packaging/test/bats_helper.bash +++ b/solr/packaging/test/bats_helper.bash @@ -103,16 +103,16 @@ wait_for() { local interval="${2:-1}" # Default 1 second between retries shift 2 # Remove timeout and interval from args local command=("$@") # Remaining args are the command to execute - + local end_time=$(($(date +%s) + timeout)) - + while [ $(date +%s) -lt $end_time ]; do if "${command[@]}"; then return 0 fi sleep "$interval" done - + return 1 # Timeout reached } diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.bats index 313514d71fe2..b85a168833b9 100644 --- a/solr/packaging/test/test_basic_auth.bats +++ b/solr/packaging/test/test_basic_auth.bats @@ -19,14 +19,14 @@ load bats_helper setup() { common_clean_setup - + echo "Starting Solr" solr start -Dsolr.packages.enabled=true - - # The auth command exports some system variables that are injected as basic auth username and password, + + # 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_INCLUDE=/force/credentials/to/be/supplied solr auth enable --type basicAuth --credentials name:password - + solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000 } @@ -45,28 +45,28 @@ teardown() { @test "create, config, api, and delete with basic auth" { # Test create - run solr create -u name:password -c COLL_NAME + run solr create -u name:password -c COLL_NAME assert_output --partial "Created collection 'COLL_NAME'" - + # Test config run solr config -u name:password -c COLL_NAME --action set-property --property updateHandler.autoCommit.maxDocs --value 100 --solr-url http://localhost:${SOLR_PORT}/solr assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100" - + # Test api run solr api -u name:password --solr-url "http://localhost:${SOLR_PORT}/solr/COLL_NAME/select?q=*:*" --verbose assert_output --partial '"numFound":0' - + # Test delete run solr delete --credentials name:password -c COLL_NAME -z localhost:${ZK_PORT} --delete-config --verbose assert_output --partial "Deleted collection 'COLL_NAME'" refute collection_exists "COLL_NAME" refute config_exists "COLL_NAME" - + } @test "post, postlogs and export with basic auth" { run solr create -c COLL_NAME - run solr create -u name:password -c COLL_NAME + run solr create -u name:password -c COLL_NAME assert_output --partial "Created collection 'COLL_NAME'" # Test post @@ -76,15 +76,15 @@ run solr create -c COLL_NAME # Test postlogs 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 #run solr export -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME --query "*:*" --output "${BATS_TEST_TMPDIR}/output" #assert_output --partial 'Export complete' - + } @test "package with basic auth" { - + run solr package deploy PACKAGE_NAME --credentials name:password --collections foo-1.2 # verify that package tool is communicating with Solr via basic auth assert_output --partial "Collection(s) doesn't exist: [foo-1.2]" From 8679d8d5bb80ee96763885a1f822d4ee3d28eb89 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 15:17:25 +0530 Subject: [PATCH 21/24] cl proper --- changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml | 6 +----- changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml diff --git a/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml b/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml index 7a535be4f2f3..7e873f5c312b 100644 --- a/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml +++ b/changelog/unreleased/PR#5054-picocli-cli-small-fixes.yml @@ -1,14 +1,10 @@ title: > The SOLR_CONNECTION environment variable (solr.connection system property) is now honored by the - bin/solr commands as documented. Fixed Integration Tests(BATs) for PicoCLI cutover. + bin/solr commands as documented. type: fixed authors: - name: Jan Høydahl nick: janhoy - - name: Jalaz Kumar - nick: jaykay12 links: - name: PR#5054 url: https://github.com/apache/solr/pull/5054 - - name: PR#5204 - url: https://github.com/apache/solr/pull/5204 diff --git a/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml b/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml new file mode 100644 index 000000000000..138aac2a1ff1 --- /dev/null +++ b/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml @@ -0,0 +1,9 @@ +title: > + Fixing BATs(Integration Tests) for PicoCLI migration- #5204 +type: fixed +authors: + - name: Jalaz Kumar + nick: jaykay12 +links: + - name: SOLR-18566 + url: https://issues.apache.org/jira/browse/SOLR-18566 \ No newline at end of file From 7eb288a6f5777770d4472fc2c550b66e0d1cec12 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Fri, 23 Oct 2026 15:21:06 +0530 Subject: [PATCH 22/24] cl final --- changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml b/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml index 138aac2a1ff1..218f8cf5abbe 100644 --- a/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml +++ b/changelog/unreleased/SOLR-18566-picocli-bats-fixed.yml @@ -1,9 +1,10 @@ title: > - Fixing BATs(Integration Tests) for PicoCLI migration- #5204 + 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 \ No newline at end of file + url: https://issues.apache.org/jira/browse/SOLR-18566 + \ No newline at end of file From 1fa1472ce5e5943085a455c885d20b21c436b5e0 Mon Sep 17 00:00:00 2001 From: jaykay12 Date: Mon, 26 Oct 2026 11:13:57 +0530 Subject: [PATCH 23/24] pr comments --- solr/core/src/java/org/apache/solr/cli/AuthTool.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index edc3f4f0535d..4b905585e5d1 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -177,8 +177,7 @@ record AuthParams( names = {"--solr-include-file"}, paramLabel = "FILE", required = true, - // Always supplied by bin/solr (from SOLR_INCLUDE); hidden because a user-supplied copy would - // be a duplicate, which picocli rejects. + // 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.") From 9f1df2c89b26200dc1c61bdf61bc619dd51b6944 Mon Sep 17 00:00:00 2001 From: Jalaz Kumar Date: Mon, 26 Oct 2026 11:16:07 +0530 Subject: [PATCH 24/24] Fix comment formatting in bats_helper.bash --- solr/packaging/test/bats_helper.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/packaging/test/bats_helper.bash b/solr/packaging/test/bats_helper.bash index e24ec0193512..5e3054d73e6b 100644 --- a/solr/packaging/test/bats_helper.bash +++ b/solr/packaging/test/bats_helper.bash @@ -117,7 +117,7 @@ wait_for() { } # 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 +# TODO: Remove this once commons-cli cleanup happens assert_output_for_cli() { if [ -n "${SOLR_PICOCLI:-}" ]; then assert_output --partial "$2"