From 47680cc17dea5164caf085b40ca63b958a2a0eeb Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Mon, 17 Apr 2017 12:05:39 -0700 Subject: [PATCH] let test_choose_a_port_for_me pass when service registry is missing, i.e. when not running with rethinkdb --- setup.py | 2 +- tests/test_warcprox.py | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index 7302ec3..4483f14 100755 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ except: setuptools.setup( name='warcprox', - version='2.1b1.dev70', + version='2.1b1.dev71', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/tests/test_warcprox.py b/tests/test_warcprox.py index 3503da1..c61f6d8 100755 --- a/tests/test_warcprox.py +++ b/tests/test_warcprox.py @@ -1369,23 +1369,24 @@ def test_choose_a_port_for_me(service_registry): th = threading.Thread(target=controller.run_until_shutdown) th.start() try: - - # check that service registry entry lists the correct port - start = time.time() - ports = [] - while time.time() - start < 30: - svcs = service_registry.available_services('warcprox') - ports = [svc['port'] for svc in svcs] - if controller.proxy.server_port in ports: - break - assert controller.proxy.server_port in ports - # check that the status api lists the correct port url = 'http://localhost:%s/status' % controller.proxy.server_port response = requests.get(url) assert response.status_code == 200 status = json.loads(response.content.decode('ascii')) assert status['port'] == controller.proxy.server_port + + if service_registry: + # check that service registry entry lists the correct port + start = time.time() + ports = [] + while time.time() - start < 30: + svcs = service_registry.available_services('warcprox') + ports = [svc['port'] for svc in svcs] + if controller.proxy.server_port in ports: + break + assert controller.proxy.server_port in ports + finally: controller.stop.set() th.join()