From 479df8ecec5c5f52a61d9a1295dd51a1933226cc Mon Sep 17 00:00:00 2001 From: "Malte S. Stretz" Date: Sat, 20 Nov 2021 17:55:21 +0100 Subject: [PATCH] Add test case for unavailable upstream --- tests/scripts/run_tests.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index d64ea6a..5a8ecd8 100755 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -83,6 +83,7 @@ DefaultErrorFile "$TINYPROXY_DATA_DIR/debug.html" ErrorFile 400 "$TINYPROXY_DATA_DIR/debug.html" ErrorFile 403 "$TINYPROXY_DATA_DIR/debug.html" ErrorFile 501 "$TINYPROXY_DATA_DIR/debug.html" +ErrorFile 502 "$TINYPROXY_DATA_DIR/debug.html" StatFile "$TINYPROXY_DATA_DIR/stats.html" Logfile "$TINYPROXY_LOG_FILE" PidFile "$TINYPROXY_PID_FILE" @@ -99,6 +100,7 @@ XTinyproxy Yes AddHeader "X-My-Header1" "Powered by Tinyproxy" AddHeader "X-My-Header2" "Powered by Tinyproxy" AddHeader "X-My-Header3" "Powered by Tinyproxy" +Upstream http 255.255.255.255:65535 ".invalid" EOF cat << 'EOF' > $TINYPROXY_FILTER_FILE @@ -244,6 +246,10 @@ test "x$?" = "x0" || FAILED=$((FAILED + 1)) echo -n "requesting connect method to denied port..." run_failure_webclient_request 403 --method=CONNECT "$TINYPROXY_IP:$TINYPROXY_PORT" "localhost:12345" test "x$?" = "x0" || FAILED=$((FAILED + 1)) + +echo -n "testing unavailable backend..." +run_failure_webclient_request 502 "$TINYPROXY_IP:$TINYPROXY_PORT" "http://bogus.invalid" +test "x$?" = "x0" || FAILED=$((FAILED + 1)) } basic_test