-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_reply_broadcast.sh
More file actions
executable file
·93 lines (75 loc) · 3.2 KB
/
Copy pathtest_reply_broadcast.sh
File metadata and controls
executable file
·93 lines (75 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Test script to verify AskQuestionReply and WorkReportReply broadcast handling
echo "Testing Flutter client AskQuestionReply broadcast handling..."
# Start the server in background
echo "Starting server..."
PORT=8081 ./bin/agentassistant-srv > server.log 2>&1 &
SERVER_PID=$!
# Wait for server to start
sleep 3
echo "Server started with PID: $SERVER_PID"
echo "Please manually:"
echo "1. Start TWO Flutter clients (or one Flutter + one Web client)"
echo "2. Connect both clients to the server using token 'test-token'"
echo "3. Press Enter to send test messages"
read -p "Press Enter when both clients are connected..."
# Send a test AskQuestion message
echo "=== Test 1: AskQuestion Broadcast ==="
echo "Sending AskQuestion message..."
curl -X POST http://localhost:8081/agentassistproto.SrvAgentAssist/AskQuestion \
-H "Content-Type: application/connect+proto" \
-H "Connect-Protocol-Version: 1" \
-d '{
"ID": "test-broadcast-question",
"UserToken": "test-token",
"Request": {
"ProjectDirectory": "/test",
"Question": "Should we deploy the new feature to production?",
"Timeout": 300
}
}' &
CURL_PID1=$!
echo "AskQuestion message sent. Both clients should see the question."
echo "Now reply to the question from ONE client (using OK, Continue, or custom text)."
echo "The OTHER client should automatically update to show 'already replied'."
read -p "Press Enter after testing question reply broadcast..."
# Send a work_report message
echo "=== Test 2: WorkReport Broadcast ==="
echo "Sending WorkReport message..."
curl -X POST http://localhost:8081/agentassistproto.SrvAgentAssist/WorkReport \
-H "Content-Type: application/connect+proto" \
-H "Connect-Protocol-Version: 1" \
-d '{
"ID": "test-broadcast-task",
"UserToken": "test-token",
"Request": {
"ProjectDirectory": "/test",
"Summary": "Code review completed for PR #123"
}
}' &
WORK_REPORT_CURL_PID=$!
echo "WorkReport message sent. Both clients should see the task."
echo "Now confirm the task from ONE client (using OK, Continue, or custom text)."
echo "The OTHER client should automatically update to show 'already confirmed'."
read -p "Press Enter after testing task confirmation broadcast..."
echo "=== Expected Behavior ==="
echo "✅ Both clients receive the same messages"
echo "✅ When one client replies/confirms, the other client sees status update"
echo "✅ Message status changes from '待处理' to '已回复' or '已确认'"
echo "✅ No duplicate replies are possible"
echo "✅ Real-time synchronization between clients"
echo "=== Server Logs ==="
echo "Checking server logs for broadcast messages..."
cat server.log | grep -E "(broadcast|notification|reply)" | tail -10 || echo "No broadcast messages found"
# Cleanup
echo "=== Cleanup ==="
kill $CURL_PID1 2>/dev/null
kill $WORK_REPORT_CURL_PID 2>/dev/null
kill $SERVER_PID 2>/dev/null
echo "Test completed!"
echo ""
echo "If the broadcast handling is working correctly, you should have observed:"
echo "1. Messages appearing in both clients simultaneously"
echo "2. Status updates propagating from one client to another"
echo "3. Prevention of duplicate replies/confirmations"
echo "4. Real-time collaboration between multiple users"