55 lines
1.5 KiB
Bash
Executable File
55 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Contract tests for the PR-4 parity-recovery release gate. Fixtures leave the
|
|
# production matrix untouched and prove that blocked/unowned rows cannot pass.
|
|
set -euo pipefail
|
|
|
|
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
temporary_dir="$(mktemp -d)"
|
|
trap 'rm -rf "$temporary_dir"' EXIT
|
|
|
|
write_matrix() {
|
|
local path="$1"
|
|
local status="$2"
|
|
local evidence="$3"
|
|
cat >"$path" <<EOF
|
|
# fixture
|
|
|
|
| ASCII module | Status | Godot evidence / target owner |
|
|
| --- | --- | --- |
|
|
| \`test_fixture.py\` | $status | $evidence |
|
|
EOF
|
|
}
|
|
|
|
assert_gate_passes() {
|
|
local name="$1"
|
|
local status="$2"
|
|
local evidence="$3"
|
|
local matrix="$temporary_dir/${name}.md"
|
|
write_matrix "$matrix" "$status" "$evidence"
|
|
MATRIX_PATH="$matrix" "$root_dir/scripts/run-parity-gauntlet.sh" --matrix-only
|
|
}
|
|
|
|
assert_gate_fails() {
|
|
local name="$1"
|
|
local status="$2"
|
|
local evidence="$3"
|
|
local matrix="$temporary_dir/${name}.md"
|
|
local log="$temporary_dir/${name}.log"
|
|
write_matrix "$matrix" "$status" "$evidence"
|
|
set +e
|
|
MATRIX_PATH="$matrix" "$root_dir/scripts/run-parity-gauntlet.sh" --matrix-only >"$log" 2>&1
|
|
local status_code=$?
|
|
set -e
|
|
if [[ "$status_code" -eq 0 ]]; then
|
|
echo "parity recovery gate unexpectedly accepted $name" >&2
|
|
cat "$log" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
assert_gate_passes "complete-owned" "replaced" 'PR-4 — `test_fixture.gd`'
|
|
assert_gate_fails "blocked" "blocked" "PR-4 — pending"
|
|
assert_gate_fails "unowned" "ported" ""
|
|
|
|
echo "parity recovery gate contracts passed"
|