]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add timeout to url get requests
authorMark Andrews <marka@isc.org>
Wed, 2 Jun 2021 06:40:58 +0000 (16:40 +1000)
committerMark Andrews <marka@isc.org>
Wed, 2 Jun 2021 22:18:21 +0000 (22:18 +0000)
to prevent the system test taking forever on failures.

bin/tests/system/statschannel/tests-json.py
bin/tests/system/statschannel/tests-xml.py

index aa6e500d0558d445124ad272eadef32b45608ffa..fd0284233ee0e7beb86dc9ce9231c0bd96b087a7 100755 (executable)
@@ -22,7 +22,8 @@ from helper import fmt
 # JSON helper functions
 def fetch_zones_json(statsip, statsport):
 
-    r = requests.get("http://{}:{}/json/v1/zones".format(statsip, statsport))
+    r = requests.get("http://{}:{}/json/v1/zones".format(statsip, statsport),
+                     timeout=600)
     assert r.status_code == 200
 
     data = r.json()
@@ -31,7 +32,8 @@ def fetch_zones_json(statsip, statsport):
 
 def fetch_traffic_json(statsip, statsport):
 
-    r = requests.get("http://{}:{}/json/v1/traffic".format(statsip, statsport))
+    r = requests.get("http://{}:{}/json/v1/traffic".format(statsip, statsport),
+                     timeout=600)
     assert r.status_code == 200
 
     data = r.json()
index e19397cb4c261f075d79c23026ed835b00f760da..3f1b0d7236cc84e935b51ece4e340218506b5409 100755 (executable)
@@ -23,7 +23,8 @@ from helper import fmt
 # XML helper functions
 def fetch_zones_xml(statsip, statsport):
 
-    r = requests.get("http://{}:{}/xml/v3/zones".format(statsip, statsport))
+    r = requests.get("http://{}:{}/xml/v3/zones".format(statsip, statsport),
+                     timeout=600)
     assert r.status_code == 200
 
     root = ET.fromstring(r.text)
@@ -47,7 +48,8 @@ def fetch_traffic_xml(statsip, statsport):
 
         return out
 
-    r = requests.get("http://{}:{}/xml/v3/traffic".format(statsip, statsport))
+    r = requests.get("http://{}:{}/xml/v3/traffic".format(statsip, statsport),
+                     timeout=600)
     assert r.status_code == 200
 
     root = ET.fromstring(r.text)