-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstress_test.py
48 lines (41 loc) · 1022 Bytes
/
stress_test.py
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
#!/usr/bin/env python
import unittest
from request_threads import RequestThreads
class StressTest(unittest.TestCase):
# Change this number to stress check your system
NUMBER_THREADS = 255
def __init__(self, *args):
super(StressTest, self).__init__(*args)
self._get_threads = []
self._post_threads = []
for i in range(self.NUMBER_THREADS):
self._get_threads.append(
RequestThreads(
i,
'GET Thread' + str(i),
'GET',
)
)
#self._post_threads.append(
# RequestThreads(
# i,
# 'POST Thread' + str(i),
# 'POST',
# )
#)
def test_get_requests(self):
counter = 0
for i in range(self.NUMBER_THREADS):
counter += 1
self._get_threads[i].start()
if counter == self.NUMBER_THREADS:
self.assertTrue(True)
#def test_post_requests(self):
# counter = 0
# for i in range(self.NUMBER_THREADS):
# counter += 1
# self._post_threads[i].start()
# if counter == self.NUMBER_THREADS:
# self.assertTrue(True)
if __name__ == "__main__":
unittest.main()