-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-all-tests.sh
executable file
·123 lines (106 loc) · 2.38 KB
/
run-all-tests.sh
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
server_pid=0
function start_server {
echo "Starting server..."
python3 ./src/server.py &
server_pid=$!
echo "Server started with pid $server_pid"
}
function stop_server {
echo "Stopping server..."
kill -9 $server_pid
echo "Server stopped"
}
function is_success {
if [ $? -eq 0 ]; then
echo "Test passed"
else
echo "Test failed"
stop_server
exit 1
fi
}
function run_test_subscribe {
start_server
echo "Running test subscriber..."
pytest src/test.py::test_subscribe
is_success
stop_server
}
function run_test_subscribe_client {
start_server
echo "Running test subscriber client..."
pytest -W ignore::pytest.PytestUnhandledThreadExceptionWarning src/test.py::test_subscribe_client
is_success
stop_server
}
function run_test_unsubscribe {
start_server
echo "Running test unsubscribe..."
pytest src/test.py::test_unsubscribe
is_success
stop_server
}
function run_test_publish {
start_server
echo "Running test publish..."
pytest src/test.py::test_publish
is_success
stop_server
}
function run_test_publish_client {
start_server
echo "Running test publish..."
pytest -W ignore::pytest.PytestUnhandledThreadExceptionWarning src/test.py::test_publish_client
is_success
stop_server
}
function run_test_list_topics {
start_server
echo "Running test list topics..."
pytest src/test.py::test_list_topics
is_success
stop_server
}
function run_test_get_topic_status {
start_server
echo "Running test get topic status..."
pytest src/test.py::test_get_topic_status
is_success
stop_server
}
function run_test_heartbeat {
start_server
echo "Running test heartbeat..."
pytest src/test.py::test_heartbeat
is_success
stop_server
}
function run_test_cleanup_topic {
start_server
echo "Running test cleanup topic..."
pytest src/test.py::test_cleanup_topic
is_success
stop_server
}
function run_all_tests {
run_test_subscribe
wait 1
run_test_subscribe_client
wait 1
run_test_unsubscribe
wait 1
run_test_publish
wait 1
run_test_publish_client
wait 1
run_test_list_topics
wait 1
run_test_get_topic_status
wait 1
run_test_heartbeat
wait 1
run_test_cleanup_topic
echo "============"
echo "All tests passed"
}
run_all_tests