##// END OF EJS Templates
better handle controller/engines never starting in tests
MinRK -
Show More
@@ -25,18 +25,19 b' blackhole = tempfile.TemporaryFile()'
25 25 # nose setup/teardown
26 26
27 27 def setup():
28 cp = Popen('ipcontroller --profile iptest -r --log-level 10 --log-to-file'.split(), stdout=blackhole, stderr=STDOUT)
28 cp = Popen('ipcontroller --profile iptest -r --log-level 10 --log-to-file --usethreads'.split(), stdout=blackhole, stderr=STDOUT)
29 processes.append(cp)
29 30 engine_json = os.path.join(get_ipython_dir(), 'cluster_iptest', 'security', 'ipcontroller-engine.json')
30 31 client_json = os.path.join(get_ipython_dir(), 'cluster_iptest', 'security', 'ipcontroller-client.json')
31 while not os.path.exists(engine_json) and not os.path.exists(client_json):
32 tic = time.time()
33 while not os.path.exists(engine_json) or not os.path.exists(client_json):
34 if cp.poll() is not None:
35 print cp.poll()
36 raise RuntimeError("The test controller failed to start.")
37 elif time.time()-tic > 10:
38 raise RuntimeError("Timeout waiting for the test controller to start.")
32 39 time.sleep(0.1)
33 processes.append(cp)
34 40 add_engines(1)
35 c = Client(profile='iptest')
36 while not c.ids:
37 time.sleep(.1)
38 c.spin()
39 c.close()
40 41
41 42 def add_engines(n=1, profile='iptest'):
42 43 rc = Client(profile=profile)
@@ -47,7 +48,12 b" def add_engines(n=1, profile='iptest'):"
47 48 # ep.start()
48 49 processes.append(ep)
49 50 eps.append(ep)
51 tic = time.time()
50 52 while len(rc) < base+n:
53 if any([ ep.poll() is not None for ep in eps ]):
54 raise RuntimeError("A test engine failed to start.")
55 elif time.time()-tic > 10:
56 raise RuntimeError("Timeout waiting for engines to connect.")
51 57 time.sleep(.1)
52 58 rc.spin()
53 59 rc.close()
General Comments 0
You need to be logged in to leave comments. Login now