make test_method_filter() pass by waiting

in test_limit_large_resource() for url processing to finish, to prevent
stats from affecting the subsequent test
This commit is contained in:
Noah Levitt 2018-02-20 14:54:58 -08:00
parent ff8bd7f121
commit f3e270b796
2 changed files with 7 additions and 1 deletions

View File

@ -40,7 +40,7 @@ except:
setuptools.setup( setuptools.setup(
name='warcprox', name='warcprox',
version='2.4b2.dev149', version='2.4b2.dev150',
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',

View File

@ -1224,11 +1224,17 @@ def test_limit_large_resource(archiving_proxies, http_daemon, warcprox_):
soon as it passes the 200000 limit. As warcprox read() chunk size is 65536, soon as it passes the 200000 limit. As warcprox read() chunk size is 65536,
the expected result size is 65536*4=262144. the expected result size is 65536*4=262144.
""" """
urls_before = warcprox_.proxy.running_stats.urls
url = 'http://localhost:%s/300k-content' % http_daemon.server_port url = 'http://localhost:%s/300k-content' % http_daemon.server_port
response = requests.get( response = requests.get(
url, proxies=archiving_proxies, verify=False, timeout=10) url, proxies=archiving_proxies, verify=False, timeout=10)
assert len(response.content) == 262144 assert len(response.content) == 262144
# wait for processing of this url to finish so that it doesn't interfere
# with subsequent tests
wait(lambda: warcprox_.proxy.running_stats.urls - urls_before == 1)
def test_method_filter( def test_method_filter(
warcprox_, https_daemon, http_daemon, archiving_proxies, warcprox_, https_daemon, http_daemon, archiving_proxies,
playback_proxies): playback_proxies):