mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 10:34:10 +00:00
wait for proxy to exit in test_external_proxy
.terminate() only sends the signal, it doesn't wait for the process to exit. If the process doesn't exit promptly, the next instance may try to grab the port before the previous process has released it, causing failure with EADDRINUSE.
This commit is contained in:
@@ -66,6 +66,7 @@ def test_external_proxy(request):
|
||||
def _cleanup_proxy():
|
||||
if proxy.poll() is None:
|
||||
proxy.terminate()
|
||||
proxy.wait(timeout=10)
|
||||
request.addfinalizer(_cleanup_proxy)
|
||||
|
||||
def wait_for_proxy():
|
||||
@@ -98,6 +99,7 @@ def test_external_proxy(request):
|
||||
|
||||
# teardown the proxy and start a new one in the same place
|
||||
proxy.terminate()
|
||||
proxy.wait(timeout=10)
|
||||
proxy = Popen(cmd, env=env)
|
||||
yield wait_for_proxy()
|
||||
|
||||
@@ -115,6 +117,7 @@ def test_external_proxy(request):
|
||||
|
||||
# teardown the proxy, and start a new one with different auth and port
|
||||
proxy.terminate()
|
||||
proxy.wait(timeout=10)
|
||||
new_auth_token = 'different!'
|
||||
env['CONFIGPROXY_AUTH_TOKEN'] = new_auth_token
|
||||
proxy_port = 55432
|
||||
|
Reference in New Issue
Block a user