File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ assertHttpRequestEquals() {
7171
7272 if [ " ${expected_response_code} " != " ${actual_response_code} " ]; then
7373 e " Response code didn't match expectation. Request [${method} ${uri} ] Expected [${expected_response_code} ] Actual [${actual_response_code} ]"
74- e " curl command: ${curl_cmd} -s -o /dev/null -w '%{http_code}' '${uri} '"
74+ e " curl command: ${curl_cmd} -s -o /dev/null -w '%{http_code}' --head '${uri} '"
7575 exit ${test_fail_exit_code}
7676 fi
7777 elif [ " ${method} " = " GET" ]; then
@@ -104,6 +104,21 @@ assertHttpRequestEquals() {
104104 fi
105105}
106106
107+ # Check to see if HTTP server is available
108+ set +o errexit
109+ # Allow curl command to fail with a non-zero exit code for this block because
110+ # we want to use it to test to see if the server is actually up.
111+ for (( i= 1 ; i<= 3 ; i++ )) ; do
112+ response=" $( ${curl_cmd} -s -o /dev/null -w ' %{http_code}' --head " ${test_server} " ) "
113+ if [ " ${response} " != " 000" ]; then
114+ break
115+ fi
116+ wait_time=" $(( i * 2 )) "
117+ e " Failed to access ${test_server} - trying again in ${wait_time} seconds, try ${i} /3"
118+ sleep ${wait_time}
119+ done
120+ set -o errexit
121+
107122# Ordinary filenames
108123
109124assertHttpRequestEquals " HEAD" " a.txt" " 200"
You can’t perform that action at this time.
0 commit comments