aboutsummaryrefslogtreecommitdiff
path: root/tests/e2e.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e.sh')
-rwxr-xr-xtests/e2e.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh
index 52367d2..d9b4381 100755
--- a/tests/e2e.sh
+++ b/tests/e2e.sh
@@ -1207,6 +1207,36 @@ expect "one sound, the finished one's" "cat $SOUNDS" done
expect "the menu lists it idle" "mb --print | grep -F 'can · c2' | cut -f1" "○ idle"
t kill-session -t can
+# --- 28. a failed run ---------------------------------------------------------
+echo "28. failed runs"
+error_report() { # pane error
+ python3 - "$HOOK" "$1" "$2" <<'PY'
+import json, socket, sys
+params = {"pane_id": sys.argv[2], "agent": "pi", "state": "idle", "error": sys.argv[3]}
+s = socket.socket(socket.AF_UNIX)
+s.connect(sys.argv[1])
+s.sendall((json.dumps({"method": "pane.report_agent", "params": params}) + "\n").encode())
+s.close()
+PY
+}
+t new-session -d -s fl -n f1 -c "$DIR" "$DIR/bin/pi"
+F1=$(t display -p -t fl:f1 '#{pane_id}')
+report "$F1" working ""
+expect "working" "opt $F1 @agent_state" working 50
+sleep 3.5; : >"$SOUNDS"; : >"$NOTES"
+error_report "$F1" "401: invalid x-api-key"
+expect "failed: done" "opt $F1 @agent_state" done 50
+expect "with why" "opt $F1 @dingger_error" "401: invalid x-api-key"
+expect "a 'failed' notification, with why" "grep -c '^pi failed|fl:f1 (pi): 401: invalid x-api-key$' $NOTES" 1 60
+expect "the 'needs attention' sound" "cat $SOUNDS" request
+expect "dingger status: failed, and why" "$DINGGER status | grep -F 'fl · f1' | grep -oE '^failed .* · 401: invalid x-api-key$' | wc -l | tr -d ' '" 1
+report "$F1" working ""
+expect "a new run: the failure goes" "opt $F1 @dingger_error" "" 50
+report "$F1" idle ""
+expect "finished: done" "opt $F1 @agent_state" done 50
+expect "with no failure" "opt $F1 @dingger_error" ""
+t kill-session -t fl
+
# Every daemon this run started must stop with it.
kill "$DAEMON_PID" "$DAEMON2_PID" 2>/dev/null
expect "the test daemons stop" "ps -o pid= -p $DAEMON_PID,$DAEMON2_PID | wc -l | tr -d ' '" 0