]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't tests stats channels that haven't been configured
authorMark Andrews <marka@isc.org>
Fri, 17 Sep 2021 06:34:25 +0000 (16:34 +1000)
committerEvan Hunt <each@isc.org>
Thu, 14 Oct 2021 05:30:45 +0000 (22:30 -0700)
pytest was failing because it was testing features that had
not been configured.  test to see if those features have been
configured before running the tests.

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

index fd0284233ee0e7beb86dc9ce9231c0bd96b087a7..33cc0b1f967b90b71f7efa92d605d5a7fffe3544 100755 (executable)
@@ -12,6 +12,8 @@
 
 from datetime import datetime
 
+import os
+
 import pytest
 import requests
 
@@ -72,6 +74,8 @@ def load_zone_json(zone):
 
 @pytest.mark.json
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1",
+                    reason="JSON not configured")
 def test_zone_timers_primary_json(statsport):
     generic.test_zone_timers_primary(fetch_zones_json, load_timers_json,
                                      statsip="10.53.0.1", statsport=statsport,
@@ -80,6 +84,8 @@ def test_zone_timers_primary_json(statsport):
 
 @pytest.mark.json
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1",
+                    reason="JSON not configured")
 def test_zone_timers_secondary_json(statsport):
     generic.test_zone_timers_secondary(fetch_zones_json, load_timers_json,
                                        statsip="10.53.0.3", statsport=statsport,
@@ -88,6 +94,8 @@ def test_zone_timers_secondary_json(statsport):
 
 @pytest.mark.json
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1",
+                    reason="JSON not configured")
 def test_zone_with_many_keys_json(statsport):
     generic.test_zone_with_many_keys(fetch_zones_json, load_zone_json,
                                      statsip="10.53.0.2", statsport=statsport)
@@ -96,6 +104,8 @@ def test_zone_with_many_keys_json(statsport):
 @pytest.mark.json
 @pytest.mark.requests
 @pytest.mark.dnspython
+@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1",
+                    reason="JSON not configured")
 def test_traffic_json(port, statsport):
     generic.test_traffic(fetch_traffic_json,
                          statsip="10.53.0.2", statsport=statsport,
index 3f1b0d7236cc84e935b51ece4e340218506b5409..b181385cbc0b787fa7c384bf8b5c24526b0b4c79 100755 (executable)
@@ -13,6 +13,8 @@
 import xml.etree.ElementTree as ET
 from datetime import datetime
 
+import os
+
 import pytest
 import requests
 
@@ -102,6 +104,8 @@ def load_zone_xml(zone):
 
 @pytest.mark.xml
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEXMLSTATS", "unset") != "1",
+                    reason="XML not configured")
 def test_zone_timers_primary_xml(statsport):
     generic.test_zone_timers_primary(fetch_zones_xml, load_timers_xml,
                                      statsip="10.53.0.1", statsport=statsport,
@@ -110,6 +114,8 @@ def test_zone_timers_primary_xml(statsport):
 
 @pytest.mark.xml
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEXMLSTATS", "unset") != "1",
+                    reason="XML not configured")
 def test_zone_timers_secondary_xml(statsport):
     generic.test_zone_timers_secondary(fetch_zones_xml, load_timers_xml,
                                        statsip="10.53.0.3", statsport=statsport,
@@ -118,6 +124,8 @@ def test_zone_timers_secondary_xml(statsport):
 
 @pytest.mark.xml
 @pytest.mark.requests
+@pytest.mark.skipif(os.getenv("HAVEXMLSTATS", "unset") != "1",
+                    reason="XML not configured")
 def test_zone_with_many_keys_xml(statsport):
     generic.test_zone_with_many_keys(fetch_zones_xml, load_zone_xml,
                                      statsip="10.53.0.2", statsport=statsport)
@@ -126,6 +134,8 @@ def test_zone_with_many_keys_xml(statsport):
 @pytest.mark.xml
 @pytest.mark.requests
 @pytest.mark.dnspython
+@pytest.mark.skipif(os.getenv("HAVEXMLSTATS", "unset") != "1",
+                    reason="XML not configured")
 def test_traffic_xml(port, statsport):
     generic.test_traffic(fetch_traffic_xml,
                          statsip="10.53.0.2", statsport=statsport,