Skip to content

Commit fec795b

Browse files
committed
Reproduce AdminUI 401 when basicAuth
1 parent a330e81 commit fec795b

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

solr/packaging/test/test_basic_auth.bats

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ load bats_helper
1919

2020
setup() {
2121
common_clean_setup
22-
22+
2323
echo "Starting Solr"
2424
solr start -Dsolr.packages.enabled=true
25-
26-
# The auth command exports some system variables that are injected as basic auth username and password,
25+
26+
# The auth command exports some system variables that are injected as basic auth username and password,
2727
# however that defeats our test so fake that out via --solr-include-file param specifing a bogus path.
2828
solr auth enable --type basicAuth --credentials name:password --solr-include-file /force/credentials/to/be/supplied
29-
29+
3030
solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000
3131
}
3232

@@ -45,28 +45,28 @@ teardown() {
4545
@test "create, config, api, and delete with basic auth" {
4646

4747
# Test create
48-
run solr create -u name:password -c COLL_NAME
48+
run solr create -u name:password -c COLL_NAME
4949
assert_output --partial "Created collection 'COLL_NAME'"
50-
50+
5151
# Test config
5252
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
5353
assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"
54-
54+
5555
# Test api
5656
run solr api -u name:password --solr-url "http://localhost:${SOLR_PORT}/solr/COLL_NAME/select?q=*:*" --verbose
5757
assert_output --partial '"numFound":0'
58-
58+
5959
# Test delete
6060
run solr delete --credentials name:password -c COLL_NAME -z localhost:${ZK_PORT} --delete-config --verbose
6161
assert_output --partial "Deleted collection 'COLL_NAME'"
6262
refute collection_exists "COLL_NAME"
6363
refute config_exists "COLL_NAME"
64-
64+
6565
}
6666

6767
@test "post, postlogs and export with basic auth" {
6868
run solr create -c COLL_NAME
69-
run solr create -u name:password -c COLL_NAME
69+
run solr create -u name:password -c COLL_NAME
7070
assert_output --partial "Created collection 'COLL_NAME'"
7171

7272
# Test post
@@ -76,18 +76,24 @@ run solr create -c COLL_NAME
7676
# Test postlogs
7777
run solr postlogs -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME -rootdir ${SOLR_LOGS_DIR}/solr.log
7878
assert_output --partial 'Committed'
79-
79+
8080
# Test export
8181
#run solr export -u name:password --solr-url http://localhost:${SOLR_PORT} --name COLL_NAME --query "*:*" --output "${BATS_TEST_TMPDIR}/output"
8282
#assert_output --partial 'Export complete'
83-
83+
8484
}
8585

8686
@test "package with basic auth" {
87-
87+
8888
run solr package deploy PACKAGE_NAME --credentials name:password --collections foo-1.2
8989
# verify that package tool is communicating with Solr via basic auth
9090
assert_output --partial "Collection(s) doesn't exist: [foo-1.2]"
9191
#assert_output --partial "Deployment successful"
9292
#refute_output --partial "Invalid collection"
9393
}
94+
95+
@test "admin UI static content is excepted from basic auth" {
96+
run curl -I -s http://localhost:${SOLR_PORT}/solr/
97+
assert_output --partial "HTTP/1.1 200"
98+
assert_output --partial "Content-Type: text/html"
99+
}

0 commit comments

Comments
 (0)