#!/usr/bin/env bash # Parse commands AND env parameters, then execute every complete guarded action # with cleanup stubs. Requires Go and a POSIX shell; never contacts a cluster. # Usage: bash scripts/testops-artifact-root-guard-test.sh [scenario dir] set -euo pipefail here=$(cd "$(dirname "$0")" && pwd) dir=$(cd "${1:-$here/../testops/scenarios}" && pwd) go_cmd=${GO:-go} if [ "$("$go_cmd" env GOOS)" = windows ]; then echo 'artifact-root controls require a POSIX Go runtime (for example, in WSL)' >&2 exit 2 fi cd "$here/.." TESTOPS_SCENARIO_DIR="$dir" "$go_cmd" test ./scripts -run '^TestTestopsArtifactRootGuards$' -count=1