aboutsummaryrefslogtreecommitdiff
path: root/tests/e2e.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e.sh')
-rwxr-xr-xtests/e2e.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh
index b1709bc..52367d2 100755
--- a/tests/e2e.sh
+++ b/tests/e2e.sh
@@ -1178,6 +1178,35 @@ expect "the agent exits" "$DINGGER poke; opt $X1 @agent" "" 80
expect "its context goes with it" "opt $X1 @dingger_context" "" 50
t kill-session -t ctx
+# --- 27. a cancelled run is not done ------------------------------------------
+echo "27. cancelled runs"
+abort_report() { # pane
+ python3 - "$HOOK" "$1" <<'PY'
+import json, socket, sys
+params = {"pane_id": sys.argv[2], "agent": "pi", "state": "idle", "aborted": True}
+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 can -n c1 -c "$DIR" "$DIR/bin/pi"
+t new-window -d -t can: -n c2 -c "$DIR" "$DIR/bin/pi"
+K1=$(t display -p -t can:c1 '#{pane_id}'); K2=$(t display -p -t can:c2 '#{pane_id}')
+report "$K1" working ""; report "$K2" working ""
+expect "both working" "opt $K1 @agent_state; opt $K2 @agent_state" "working
+working" 50
+sleep 3.5; : >"$SOUNDS"; : >"$NOTES"
+# Nobody watches either: one finishes, the other is cancelled.
+report "$K1" idle ""; abort_report "$K2"
+expect "finished: done" "opt $K1 @agent_state" done 50
+expect "cancelled: idle" "opt $K2 @agent_state" idle 50
+expect "the finished one notifies" "grep -c 'pi finished|can:c1 (pi)' $NOTES" 1 60
+expect "the cancelled one does not" "grep -c 'can:c2' $NOTES" 0
+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
+
# 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