janhoy commented on code in PR #3784:
URL: https://github.com/apache/solr/pull/3784#discussion_r2448344746
##########
solr/packaging/test/bats_helper.bash:
##########
@@ -96,3 +96,60 @@ collection_exists() {
return 1
}
+
+# Wait for a collection to be queryable
+wait_for_collection() {
+ local collection="$1"
+ local timeout=${2:-180}
+ local start_ts
+ start_ts=$(date +%s)
+ while true; do
+ if curl -s -S -f
"http://localhost:${SOLR_PORT}/solr/${collection}/select?q=*:*" | grep -q
'"responseHeader"'; then
+ return 0
+ fi
+ local now
+ now=$(date +%s)
+ if [ $(( now - start_ts )) -ge ${timeout} ]; then
+ echo "Timed out waiting for collection '${collection}' to become
queryable" >&2
+ return 1
+ fi
+ sleep 3
+ done
+}
+
+# Apply the ExtractingRequestHandler via Config API and print error body on
failure
+apply_extract_handler() {
+ local collection="$1"
+ local
json="{\"add-requesthandler\":{\"name\":\"/update/extract\",\"class\":\"org.apache.solr.handler.extraction.ExtractingRequestHandler\",\"tikaserver.url\":\"http://localhost:${TIKA_PORT}\",\"defaults\":{\"lowernames\":\"true\",\"captureAttr\":\"true\"}}}"
+ local url="http://localhost:${SOLR_PORT}/solr/${collection}/config"
+ # Capture body and status code
+ local resp code body
+ sleep 5
+ resp=$(curl -s -S -w "\n%{http_code}" -X POST -H
'Content-type:application/json' -d "$json" "$url")
+ code="${resp##*$'\n'}"
+ body="${resp%$'\n'*}"
+ if [ "$code" = "200" ]; then
+ return 0
+ else
+ echo "Config API error applying ExtractingRequestHandler to ${collection}
(HTTP ${code}): ${body}" >&3
+ return 1
+ fi
+}
+
+start_tika_server_docker() {
Review Comment:
Done
--
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]