[tor-commits] [ooni-probe/master] Retry 3 times the http_requests integration tests.

art at torproject.org art at torproject.org
Mon Sep 19 12:14:25 UTC 2016


commit 7be2fc5571c9a0c7fa65de70381819f9f458e6fe
Author: Arturo Filastò <arturo at filasto.net>
Date:   Fri Sep 16 19:19:31 2016 +0200

    Retry 3 times the http_requests integration tests.
    
    Hopefully this will overcome the transient failures.
---
 ooni/tests/test_oonicli.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ooni/tests/test_oonicli.py b/ooni/tests/test_oonicli.py
index 4a6edf9..05bc273 100644
--- a/ooni/tests/test_oonicli.py
+++ b/ooni/tests/test_oonicli.py
@@ -111,6 +111,7 @@ class TestRunDirector(ConfigTestCase):
 
     @defer.inlineCallbacks
     def test_http_requests(self):
+        retries = 3
         def verify_function(entry):
             assert 'body_length_match' in entry
             assert 'body_proportion' in entry
@@ -119,10 +120,14 @@ class TestRunDirector(ConfigTestCase):
             assert 'factor' in entry
             assert 'headers_diff' in entry
             assert 'headers_match' in entry
-
-        yield self.run_helper('blocking/http_requests',
-                              ['-u', 'http://torproject.org/'],
-                              verify_function)
+        while retries > 0:
+            try:
+                yield self.run_helper('blocking/http_requests',
+                                    ['-u', 'http://torproject.org/'],
+                                    verify_function)
+                break
+            except:
+                retries -= 1
 
     @defer.inlineCallbacks
     def test_http_requests_with_file(self):





More information about the tor-commits mailing list