Skip to content

Commit 6be454b

Browse files
committedJan 20, 2025
Added initial test script for automated validation
1 parent 9ad5aeb commit 6be454b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎test/test.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/python3
2+
3+
import asyncio
4+
import sys
5+
import time
6+
7+
async def run(repetitions):
8+
cmd = './client'
9+
to_wait = []
10+
# stress test, simulate multiple concurrent connections
11+
for i in range(repetitions):
12+
to_wait.append(await asyncio.create_subprocess_shell(
13+
cmd,
14+
stdout= asyncio.subprocess.DEVNULL,
15+
stderr= asyncio.subprocess.DEVNULL
16+
))
17+
print(f"{i} executed")
18+
19+
for i in range(repetitions):
20+
await to_wait[i].communicate()
21+
print(f'[{cmd!r} exited with {to_wait[i].returncode}]')
22+
23+
if __name__ == '__main__':
24+
if len(sys.argv) < 2:
25+
repetitions = 10
26+
else:
27+
repetitions = int(sys.argv[1])
28+
asyncio.run(run(repetitions))

0 commit comments

Comments
 (0)
Please sign in to comment.