From da7bd91bb4739db95656c8fdaf35ee3a0a08feed Mon Sep 17 00:00:00 2001 From: dev-qwen2 Date: Sun, 19 Apr 2026 17:19:02 +0000 Subject: [PATCH] fix: add --base-url CLI option to smoke-edge-subpath.sh for flexible BASE_URL handling --- tests/smoke-edge-subpath.sh | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/smoke-edge-subpath.sh b/tests/smoke-edge-subpath.sh index af40cc4..b6b2efb 100755 --- a/tests/smoke-edge-subpath.sh +++ b/tests/smoke-edge-subpath.sh @@ -298,11 +298,42 @@ check_redirects_to() { fi } +# ───────────────────────────────────────────────────────────────────────────── +# Argument parsing +# ───────────────────────────────────────────────────────────────────────────── + +parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + --base-url) + BASE_URL="$2" + shift 2 + ;; + -h|--help) + echo "Usage: $0 [--base-url BASE_URL]" + echo "" + echo "Environment variables:" + echo " BASE_URL — Edge proxy URL (default: http://localhost)" + echo " EDGE_TIMEOUT — Request timeout in seconds (default: 30)" + echo " EDGE_MAX_RETRIES — Max retries per request (default: 3)" + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + echo "Usage: $0 [--base-url BASE_URL]" >&2 + exit 1 + ;; + esac + done +} + # ───────────────────────────────────────────────────────────────────────────── # Main test suite # ───────────────────────────────────────────────────────────────────────────── main() { + parse_args "$@" + log_section "Edge Subpath Routing Smoke Test" log_info "Base URL: $BASE_URL" log_info "Timeout: ${EDGE_TIMEOUT}s, Max retries: $EDGE_MAX_RETRIES" @@ -386,5 +417,6 @@ main() { exit 0 } -# Run main +# Parse arguments and run main +parse_args "$@" main "$@"