Commit 35b56408 authored by Jérome Perrin's avatar Jérome Perrin

test_networkbench: increase resolution time tolerance

We don't really care how long DNS resolution took here, since we see
cases where on test machines a name resolution takes more than one second,
increase the minimal time to something higher to prevent such failures.

Also remove not used commented out code.
parent 7954028f
...@@ -47,7 +47,7 @@ class TestDNSBench(unittest.TestCase): ...@@ -47,7 +47,7 @@ class TestDNSBench(unittest.TestCase):
self.assertEqual(info[1], 'eu.web.vifib.com') self.assertEqual(info[1], 'eu.web.vifib.com')
self.assertEqual(info[2], 200) self.assertEqual(info[2], 200)
self.assertLess(info[3], 1) self.assertLess(info[3], 30)
self.assertEqual(info[4], 'OK', self.assertEqual(info[4], 'OK',
"%s != OK, full info: %s" % (info[4], info) ) "%s != OK, full info: %s" % (info[4], info) )
self.assertEqual(set(info[5]), set([u'85.118.38.162', u'176.31.129.213']), self.assertEqual(set(info[5]), set([u'85.118.38.162', u'176.31.129.213']),
...@@ -63,7 +63,7 @@ class TestDNSBench(unittest.TestCase): ...@@ -63,7 +63,7 @@ class TestDNSBench(unittest.TestCase):
self.assertEqual(info[1], 'thisdomaindontexist.erp5.com') self.assertEqual(info[1], 'thisdomaindontexist.erp5.com')
self.assertEqual(info[2], 600) self.assertEqual(info[2], 600)
self.assertLess(info[3], 1) self.assertLess(info[3], 30)
self.assertEqual(info[4], 'Cannot resolve the hostname') self.assertEqual(info[4], 'Cannot resolve the hostname')
self.assertEqual(info[5], []) self.assertEqual(info[5], [])
...@@ -77,7 +77,7 @@ class TestDNSBench(unittest.TestCase): ...@@ -77,7 +77,7 @@ class TestDNSBench(unittest.TestCase):
self.assertEqual(info[1], 'www.erp5.com') self.assertEqual(info[1], 'www.erp5.com')
self.assertEqual(info[2], 200) self.assertEqual(info[2], 200)
self.assertLess(info[3], 1) self.assertLess(info[3], 30)
self.assertEqual(info[4], 'UNEXPECTED') self.assertEqual(info[4], 'UNEXPECTED')
self.assertTrue(info[5].startswith("['85.118.38.162'] (expected) != ")) self.assertTrue(info[5].startswith("['85.118.38.162'] (expected) != "))
...@@ -207,37 +207,3 @@ class TestHTTPBench(unittest.TestCase): ...@@ -207,37 +207,3 @@ class TestHTTPBench(unittest.TestCase):
self.assertEqual(info[2], 200) self.assertEqual(info[2], 200)
self.assertEqual(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEqual(info[4], "UNEXPECTED (COUSCOUS not in page content)") self.assertEqual(info[4], "UNEXPECTED (COUSCOUS not in page content)")
#def request(url, expected_dict):
#
# rendering_time = "%s;%s;%s;%s;%s" % \
# (curl.getinfo(curl.NAMELOOKUP_TIME),
# curl.getinfo(curl.CONNECT_TIME),
# curl.getinfo(curl.PRETRANSFER_TIME),
# curl.getinfo(curl.STARTTRANSFER_TIME),
# curl.getinfo(curl.TOTAL_TIME))
#
# response_code = curl.getinfo(pycurl.HTTP_CODE)
#
# expected_response = expected_dict.get("expected_response", None)
# if expected_response is not None and \
# expected_response != response_code:
# result = "UNEXPECTED (%s != %s)" % (expected_response, response_code)
#
# expected_text = expected_dict.get("expected_text", None)
# if expected_text is not None and \
# str(expected_text) not in str(body):
# result = "UNEXPECTED (%s not in page content)" % (expected_text)
#
#
# info_list = ('GET', url, response_code, rendering_time, result)
#
# return info_list
#
if __name__ == '__main__':
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment