|
- #!/usr/bin/env bash
- # Frontend-agnostic test runner: plain curl + a JSON parser, no PowerShell,
- # no cscript, no SSH access to the VM required. Runnable from any CLI that
- # can reach the site over HTTP.
- #
- # Usage: ./run-self-test.sh http://100.127.62.31:8090
- set -euo pipefail
-
- BASE_URL="${1:?Usage: run-self-test.sh <base-url>, e.g. http://100.127.62.31:8090}"
-
- response=$(curl -sf "$BASE_URL/self-test")
-
- echo "$response" | python3 -m json.tool
-
- ok=$(echo "$response" | python3 -c 'import json, sys; print("true" if json.load(sys.stdin)["ok"] else "false")')
-
- if [ "$ok" != "true" ]; then
- echo "RESULT: FAILURE"
- exit 1
- fi
-
- # URL Rewrite is not the only entry path: Default.asp is directly addressable.
- # Prove this test app still cannot activate a production route through its
- # internal route query string.
- hello_status=$(curl -sS -o /dev/null -w '%{http_code}' "$BASE_URL/Default.asp?route=/hello")
- if [ "$hello_status" != "404" ]; then
- echo "FAIL: test app direct Default.asp activated production route (HTTP $hello_status)" >&2
- exit 1
- fi
-
- echo "PASS: test app rejects production route through direct Default.asp"
- echo "RESULT: ALL PASS"
|