mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
whoops, stop warcprox and join thread in test_choose_a_port_for_me
This commit is contained in:
parent
1900dfac08
commit
3d87ed61be
2
setup.py
2
setup.py
@ -51,7 +51,7 @@ except:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='warcprox',
|
name='warcprox',
|
||||||
version='2.1b1.dev69',
|
version='2.1b1.dev70',
|
||||||
description='WARC writing MITM HTTP/S proxy',
|
description='WARC writing MITM HTTP/S proxy',
|
||||||
url='https://github.com/internetarchive/warcprox',
|
url='https://github.com/internetarchive/warcprox',
|
||||||
author='Noah Levitt',
|
author='Noah Levitt',
|
||||||
|
@ -1368,23 +1368,27 @@ def test_choose_a_port_for_me(service_registry):
|
|||||||
|
|
||||||
th = threading.Thread(target=controller.run_until_shutdown)
|
th = threading.Thread(target=controller.run_until_shutdown)
|
||||||
th.start()
|
th.start()
|
||||||
|
try:
|
||||||
|
|
||||||
# check that service registry entry lists the correct port
|
# check that service registry entry lists the correct port
|
||||||
start = time.time()
|
start = time.time()
|
||||||
ports = []
|
ports = []
|
||||||
while time.time() - start < 30:
|
while time.time() - start < 30:
|
||||||
svcs = service_registry.available_services('warcprox')
|
svcs = service_registry.available_services('warcprox')
|
||||||
ports = [svc['port'] for svc in svcs]
|
ports = [svc['port'] for svc in svcs]
|
||||||
if controller.proxy.server_port in ports:
|
if controller.proxy.server_port in ports:
|
||||||
break
|
break
|
||||||
assert controller.proxy.server_port in ports
|
assert controller.proxy.server_port in ports
|
||||||
|
|
||||||
# check that the status api lists the correct port
|
# check that the status api lists the correct port
|
||||||
url = 'http://localhost:%s/status' % controller.proxy.server_port
|
url = 'http://localhost:%s/status' % controller.proxy.server_port
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
status = json.loads(response.content.decode('ascii'))
|
status = json.loads(response.content.decode('ascii'))
|
||||||
assert status['port'] == controller.proxy.server_port
|
assert status['port'] == controller.proxy.server_port
|
||||||
|
finally:
|
||||||
|
controller.stop.set()
|
||||||
|
th.join()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pytest.main()
|
pytest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user