Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17567: Fix auth issue in stream tests #2877

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/cli/StreamTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ private PushBackStream doLocalMode(CommandLine cli, String expr) throws Exceptio
String zkHost = SolrCLI.getZkHost(cli);

echoIfVerbose("Connecting to ZooKeeper at " + zkHost);
solrClientCache.getCloudSolrClient(zkHost);
solrClientCache.setBasicAuthCredentials(
cli.getOptionValue(CommonCLIOptions.CREDENTIALS_OPTION));
solrClientCache.getCloudSolrClient(zkHost);

TupleStream stream;
PushBackStream pushBackStream;
Expand Down
16 changes: 15 additions & 1 deletion solr/packaging/test/test_stream.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 auth enable --type basicAuth --credentials name:password --solr-include-file /force/credentials/to/be/supplied
}

teardown_file() {
Expand Down Expand Up @@ -84,3 +84,17 @@ teardown() {
assert_output --partial 'Apple 60 GB iPod'
refute_output --partial 'ERROR'
}

@test "searching solr without credentials fails with error" {

local solr_stream_file="${BATS_TEST_TMPDIR}/search.expr"
echo 'search(techproducts,' > "${solr_stream_file}"
echo 'q="name:memory",' >> "${solr_stream_file}"
echo 'fl="name,price",' >> "${solr_stream_file}"
echo 'sort="price desc"' >> "${solr_stream_file}"
echo ')' >> "${solr_stream_file}"

run ! solr stream --execution local --header ${solr_stream_file}

assert_output --partial 'ERROR'
}
Loading