Initial import of watchdog-discord-route skill
This commit is contained in:
65
scripts/verify_watchdog_b_e2e.sh
Executable file
65
scripts/verify_watchdog_b_e2e.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
WORKSPACE="$(cd -- "$SCRIPT_DIR/../.." && pwd)"
|
||||
ARTIFACT_ROOT="${WATCHDOG_B_VERIFY_ROOT:-$WORKSPACE/state/watchdog-b-verify-e2e}"
|
||||
RUN_ID="${RUN_ID:-$(date +%Y%m%dT%H%M%S)}"
|
||||
RUN_DIR="$ARTIFACT_ROOT/$RUN_ID"
|
||||
FIXTURE_DIR="$RUN_DIR/fixture"
|
||||
LOG="$RUN_DIR/verify.log"
|
||||
STATE_DIR="$RUN_DIR/state"
|
||||
QUEUE_SNAPSHOT="$RUN_DIR/queue-before.txt"
|
||||
QUEUE_AFTER="$RUN_DIR/queue-after.txt"
|
||||
mkdir -p "$FIXTURE_DIR/host-runtime" "$FIXTURE_DIR/logs" "$STATE_DIR" "$RUN_DIR"
|
||||
|
||||
exec > >(tee -a "$LOG") 2>&1
|
||||
|
||||
echo "[verify] run_id=$RUN_ID"
|
||||
echo "[verify] workspace=$WORKSPACE"
|
||||
date -Iseconds
|
||||
|
||||
echo "[verify] snapshot owner-report queue before"
|
||||
find "$HOME/.clawteam/owner-reports" -maxdepth 2 -type f | sort > "$QUEUE_SNAPSHOT" || true
|
||||
|
||||
sleep 180 &
|
||||
FAKE_PID=$!
|
||||
trap 'kill "$FAKE_PID" 2>/dev/null || true' EXIT
|
||||
printf '%s\n' "$FAKE_PID" > "$FIXTURE_DIR/host-runtime/openclaw.pid"
|
||||
touch "$FIXTURE_DIR/logs/openclaw.log"
|
||||
|
||||
echo "[verify] run watchdog-b direct E2E (enqueue + direct delivery)"
|
||||
OPENCLAW_PID_FILE="$FIXTURE_DIR/host-runtime/openclaw.pid" \
|
||||
OPENCLAW_LOG_FILE="$FIXTURE_DIR/logs/openclaw.log" \
|
||||
STALL_AFTER_SECONDS=1200 \
|
||||
WATCHDOG_B_ARTIFACT_DIR="$STATE_DIR" \
|
||||
WATCHDOG_B_NOTIFY_DRY_RUN=0 \
|
||||
WATCHDOG_B_RUNNING_REPORT_MODE=enqueue-and-drain \
|
||||
WATCHDOG_B_RUNNING_REPORT_MIN_INTERVAL_SECONDS=0 \
|
||||
"$WORKSPACE/scripts/watchdog-b/run_watchdog_b.sh" | tee "$RUN_DIR/run-output.txt"
|
||||
|
||||
echo "[verify] snapshot owner-report queue after"
|
||||
find "$HOME/.clawteam/owner-reports" -maxdepth 2 -type f | sort > "$QUEUE_AFTER" || true
|
||||
|
||||
echo "[verify] summarize"
|
||||
REPORT_ID="$(python3 - <<'PY' "$STATE_DIR/notify-state.json"
|
||||
import json,sys
|
||||
p=sys.argv[1]
|
||||
with open(p,'r',encoding='utf-8') as f:
|
||||
data=json.load(f)
|
||||
print(data['events']['running']['last_result']['enqueue']['report_id'])
|
||||
PY
|
||||
)"
|
||||
|
||||
echo "REPORT_ID=$REPORT_ID" | tee "$RUN_DIR/result.env"
|
||||
SENT_PATH="$HOME/.clawteam/owner-reports/sent/$REPORT_ID.md"
|
||||
echo "SENT_PATH=$SENT_PATH" | tee -a "$RUN_DIR/result.env"
|
||||
if [[ ! -f "$SENT_PATH" ]]; then
|
||||
echo "[verify] ERROR: sent file missing: $SENT_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[verify] sent file found"
|
||||
sed -n '1,120p' "$SENT_PATH" | tee "$RUN_DIR/sent-head.txt"
|
||||
|
||||
echo "[verify] done"
|
||||
Reference in New Issue
Block a user