test: add localhost for no_proxy if not present

I see the checkupdate/chk-update-slow-server test fail when the
http_proxy env variable is set, but no_proxy is not set.

Resolve the issue by adding "localhost" to no_proxy if needed, since the
test web servers run on localhost.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2018-10-22 14:07:15 -07:00
committed by Otavio Pontes
parent 0f16013855
commit 69bdacb677
+8
View File
@@ -1441,6 +1441,14 @@ start_web_server() { # swupd_function
echo "$server_pid" > "$SERVER_PID_FILE"
# make sure localhost is present in no_proxy settings
if [ -n "$no_proxy" ] && grep -v 'localhost' <<< "$no_proxy"; then
no_proxy="${no_proxy},localhost"
elif [ -z "$no_proxy" ]; then
no_proxy="localhost"
fi
export no_proxy
# wait for server to be available
for i in $(seq 1 100); do
if [ -f "$PORT_FILE" ]; then