1
1
#! /usr/bin/python3
2
- from framework import tester , nginx_server
2
+ from framework import tester
3
3
4
4
from multiprocessing import Process
5
5
from random import randint
@@ -169,7 +169,6 @@ class Ws_ping(tester.TempestaTest):
169
169
# Client
170
170
171
171
def run_test (self , port , n ):
172
- time .sleep (2.0 )
173
172
asyncio .run (self .ws_ping_test (port , n ))
174
173
175
174
async def ws_ping_test (self , port , n ):
@@ -208,8 +207,6 @@ def run_ws(self, port, count=1, proxy=False):
208
207
ssl_context .load_cert_chain ("/tmp/cert.pem" , keyfile = "/tmp/key.pem" )
209
208
if proxy :
210
209
self .start_all_servers ()
211
- self .start_tempesta ()
212
-
213
210
loop = asyncio .get_event_loop ()
214
211
for i in range (count ):
215
212
asyncio .ensure_future (websockets .serve (self .handler , hostname , port + i ))
@@ -219,6 +216,9 @@ def test_ping_websockets(self):
219
216
p1 = Process (target = self .run_ws , args = (8099 ,))
220
217
p2 = Process (target = self .run_test , args = (81 , 4 ))
221
218
p1 .start ()
219
+ self .get_tempesta ().start ()
220
+ while not self .get_tempesta ().is_running ():
221
+ pass
222
222
p2 .start ()
223
223
p2 .join ()
224
224
p1 .terminate ()
@@ -242,13 +242,15 @@ async def handler(self, websocket, path):
242
242
class Wss_ping (Ws_ping ):
243
243
244
244
def run_test (self , port , n ):
245
- time .sleep (2.0 )
246
245
asyncio .run (self .wss_ping_test (port , n ))
247
246
248
247
def test_ping_websockets (self ):
249
248
p1 = Process (target = self .run_ws , args = (8099 ,))
250
249
p2 = Process (target = self .run_test , args = (82 , 4 ))
251
250
p1 .start ()
251
+ self .get_tempesta ().start ()
252
+ while not self .get_tempesta ().is_running ():
253
+ pass
252
254
p2 .start ()
253
255
p2 .join ()
254
256
p1 .terminate ()
@@ -273,6 +275,9 @@ def test_ping_websockets(self):
273
275
p1 = Process (target = self .run_ws , args = (8099 , 1 , True ))
274
276
p2 = Process (target = self .run_test , args = (82 , 4 ))
275
277
p1 .start ()
278
+ self .get_tempesta ().start ()
279
+ while not self .get_tempesta ().is_running ():
280
+ pass
276
281
p2 .start ()
277
282
p2 .join ()
278
283
p1 .terminate ()
@@ -287,13 +292,15 @@ class Wss_stress(Wss_ping):
287
292
}
288
293
289
294
def run_test (self , port , n ):
290
- time .sleep (2.0 )
291
295
asyncio .run (self .wss_ping_test (port , n ))
292
296
293
297
def test_ping_websockets (self ):
294
298
p1 = Process (target = self .run_ws , args = (8099 , 8 ))
295
299
p2 = Process (target = self .run_test , args = (82 , 400 ))
296
300
p1 .start ()
301
+ self .get_tempesta ().start ()
302
+ while not self .get_tempesta ().is_running ():
303
+ pass
297
304
p2 .start ()
298
305
p2 .join ()
299
306
p1 .terminate ()
0 commit comments