fix race in test_proxy

prevent `.check_routes` from firing while we wait for a new proxy to come up

We check explicitly that it comes up with no routes, so makes sure check_routes hasn't restored its state, which is causing intermittent failures
This commit is contained in:
Min RK
2017-07-27 11:52:45 +02:00
parent 638f980281
commit afc968146d

View File

@@ -28,6 +28,9 @@ def test_external_proxy(request):
cfg.ConfigurableHTTPProxy.should_start = False
app = MockHub.instance(config=cfg)
# disable last_activity polling to avoid check_routes being called during the test,
# which races with some of our test conditions
app.last_activity_interval = 0
def fin():
MockHub.clear_instance()
@@ -53,10 +56,7 @@ def test_external_proxy(request):
def _cleanup_proxy():
if proxy.poll() is None:
print("Terminating proxy")
proxy.terminate()
else:
print("Not stopping proxy", proxy)
request.addfinalizer(_cleanup_proxy)
def wait_for_proxy():