Update test.sh
This commit is contained in:
18
test.sh
18
test.sh
@@ -230,14 +230,22 @@ function start_test_server() {
|
||||
fi
|
||||
|
||||
# If that didn't work, try host IP with mapped port (Docker-in-Docker)
|
||||
if [ "$http_code" = "000" ] && [ -n "${HOST_IP}" ]; then
|
||||
http_code=$(curl -s --max-time 2 -o /dev/null -w "%{http_code}" "http://${HOST_IP}:${TEST_PORT}/" 2>/dev/null || echo "000")
|
||||
test_urls="${test_urls}, host:${HOST_IP}:${TEST_PORT}"
|
||||
if [ "$http_code" = "000" ] || [ "$http_code" = "" ]; then
|
||||
if [ -n "${HOST_IP}" ]; then
|
||||
local host_code=$(curl -s --max-time 2 -o /dev/null -w "%{http_code}" "http://${HOST_IP}:${TEST_PORT}/" 2>/dev/null || echo "000")
|
||||
if [ "$host_code" != "000" ] && [ "$host_code" != "" ]; then
|
||||
http_code="$host_code"
|
||||
fi
|
||||
test_urls="${test_urls}, host:${HOST_IP}:${TEST_PORT}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If that didn't work, try localhost with mapped port (local Docker)
|
||||
if [ "$http_code" = "000" ]; then
|
||||
http_code=$(curl -s --max-time 2 -o /dev/null -w "%{http_code}" "http://localhost:${TEST_PORT}/" 2>/dev/null || echo "000")
|
||||
if [ "$http_code" = "000" ] || [ "$http_code" = "" ]; then
|
||||
local local_code=$(curl -s --max-time 2 -o /dev/null -w "%{http_code}" "http://localhost:${TEST_PORT}/" 2>/dev/null || echo "000")
|
||||
if [ "$local_code" != "000" ] && [ "$local_code" != "" ]; then
|
||||
http_code="$local_code"
|
||||
fi
|
||||
test_urls="${test_urls}, localhost:${TEST_PORT}"
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user