add store fallback smoke test
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
4b4a0fb99b29846d063a375eb7e8dc96d8a3a2bc- Parents
-
1f26b54 - Tree
e1a4f4d
4b4a0fb
4b4a0fb99b29846d063a375eb7e8dc96d8a3a2bc1f26b54
e1a4f4d| Status | File | + | - |
|---|---|---|---|
| M |
README.md
|
5 | 4 |
| A |
scripts/test-request-store-fallback.sh
|
47 | 0 |
README.mdmodified@@ -21,10 +21,11 @@ Current scaffold includes: | |||
| 21 | 2. Check health and request counters: `cargo run -p garwarpctl -- status` | 21 | 2. Check health and request counters: `cargo run -p garwarpctl -- status` |
| 22 | 3. Stop daemon: `cargo run -p garwarpctl -- stop` | 22 | 3. Stop daemon: `cargo run -p garwarpctl -- stop` |
| 23 | 4. Verify D-Bus activation: `./scripts/test-dbus-activation.sh` | 23 | 4. Verify D-Bus activation: `./scripts/test-dbus-activation.sh` |
| 24 | -5. Create mock request: `cargo run -p garwarpctl -- begin req-1 :1.2 - x11:0x2a` | 24 | +5. Verify request-store fallback: `./scripts/test-request-store-fallback.sh` |
| 25 | -6. Transition mock request: `cargo run -p garwarpctl -- transition req-1 :1.2 awaiting_user` | 25 | +6. Create mock request: `cargo run -p garwarpctl -- begin req-1 :1.2 - x11:0x2a` |
| 26 | -7. List known requests: `cargo run -p garwarpctl -- list` | 26 | +7. Transition mock request: `cargo run -p garwarpctl -- transition req-1 :1.2 awaiting_user` |
| 27 | -8. Inspect request snapshot: `cargo run -p garwarpctl -- inspect req-1` | 27 | +8. List known requests: `cargo run -p garwarpctl -- list` |
| 28 | +9. Inspect request snapshot: `cargo run -p garwarpctl -- inspect req-1` | ||
| 28 | 29 | ||
| 29 | ## Runtime Tuning | 30 | ## Runtime Tuning |
| 30 | 1. `GARWARP_REQUEST_TIMEOUT_MS`: timeout before in-flight requests are marked `expired`. | 31 | 1. `GARWARP_REQUEST_TIMEOUT_MS`: timeout before in-flight requests are marked `expired`. |
scripts/test-request-store-fallback.shadded@@ -0,0 +1,47 @@ | |||
| 1 | +#!/usr/bin/env bash | ||
| 2 | +set -euo pipefail | ||
| 3 | + | ||
| 4 | +repo_root="$(cd "$(dirname "$0")/.." && pwd)" | ||
| 5 | + | ||
| 6 | +runtime_dir="$(mktemp -d)" | ||
| 7 | +log_file="$(mktemp)" | ||
| 8 | +status_file="$(mktemp)" | ||
| 9 | + | ||
| 10 | +cleanup() { | ||
| 11 | + rm -f "$log_file" "$status_file" | ||
| 12 | + rm -rf "$runtime_dir" | ||
| 13 | +} | ||
| 14 | +trap cleanup EXIT | ||
| 15 | + | ||
| 16 | +mkdir -p "$runtime_dir/garwarp" | ||
| 17 | +cat > "$runtime_dir/garwarp/requests.state" <<STORE | ||
| 18 | +id=req-1 sender=:1.2 state=bogus | ||
| 19 | +STORE | ||
| 20 | + | ||
| 21 | +DBUS_FATAL_WARNINGS=0 dbus-run-session -- bash -lc ' | ||
| 22 | +set -euo pipefail | ||
| 23 | +export XDG_RUNTIME_DIR="'"$runtime_dir"'" | ||
| 24 | +cd "'"$repo_root"'" | ||
| 25 | + | ||
| 26 | +cargo run -q -p garwarp -- daemon >"'"$log_file"'" 2>&1 & | ||
| 27 | +pid=$! | ||
| 28 | + | ||
| 29 | +for _ in $(seq 1 200); do | ||
| 30 | + [ -S "$XDG_RUNTIME_DIR/garwarp/control.sock" ] && break | ||
| 31 | + sleep 0.05 | ||
| 32 | +done | ||
| 33 | + | ||
| 34 | +[ -S "$XDG_RUNTIME_DIR/garwarp/control.sock" ] | ||
| 35 | + | ||
| 36 | +cargo run -q -p garwarpctl -- status >"'"$status_file"'" | ||
| 37 | +cargo run -q -p garwarpctl -- stop >/dev/null | ||
| 38 | +wait "$pid" | ||
| 39 | +' | ||
| 40 | + | ||
| 41 | +ls "$runtime_dir/garwarp"/requests.state.corrupt-* >/dev/null | ||
| 42 | +[ -f "$runtime_dir/garwarp/requests.state" ] | ||
| 43 | +rg -q "request_store_load_failed" "$log_file" | ||
| 44 | +rg -q "request_store_quarantined" "$log_file" | ||
| 45 | +rg -q "health=" "$status_file" | ||
| 46 | + | ||
| 47 | +echo "request-store fallback smoke test passed" | ||