2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Don't tests stats channels that haven't been configured

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.
This commit is contained in:
Mark Andrews 2021-09-17 16:34:25 +10:00 committed by Evan Hunt
parent ee068e2c39
commit 10c01cba61
2 changed files with 20 additions and 0 deletions

View File

@ -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,

View File

@ -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,