-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtest-stability.sh
More file actions
executable file
·51 lines (40 loc) · 1.45 KB
/
test-stability.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.45 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
#!/bin/bash
# Script to test channel stabilization delay reliability
# Usage: ./test-stability.sh <number_of_iterations> [delay_ms]
iterations=${1:-10}
delay_ms=${2:-"current"}
if [ "$delay_ms" != "current" ]; then
echo "Note: To change delay, you need to manually edit vitest.global-setup.ts"
echo "This script will test with the current delay setting"
fi
echo "Testing channel stabilization with $iterations iterations"
echo "Current delay: Check vitest.global-setup.ts for actual value"
echo "================================================"
success_count=0
fail_count=0
for i in $(seq 1 $iterations); do
echo -n "Run $i/$iterations: "
# Run test and capture output
output=$(pnpm vitest run __tests__/dummy.test.ts 2>&1)
# Check if test passed
if echo "$output" | grep -q "Test Files 1 passed"; then
echo "✓ PASS"
success_count=$((success_count + 1))
else
echo "✗ FAIL"
fail_count=$((fail_count + 1))
# Show error if failed
if echo "$output" | grep -q "Supabase check failed"; then
error_msg=$(echo "$output" | grep "Supabase check failed" | head -1)
echo " Error: $error_msg"
fi
fi
done
echo "================================================"
echo "Results:"
echo " Success: $success_count/$iterations ($(( success_count * 100 / iterations ))%)"
echo " Failed: $fail_count/$iterations ($(( fail_count * 100 / iterations ))%)"
# Exit with non-zero if any failures
if [ $fail_count -gt 0 ]; then
exit 1
fi