Big change in config and skip mechanism
diff --git a/cvp_checks/tests/test_default_gateway.py b/cvp_checks/tests/test_default_gateway.py
index 57a6d7b..b6c74c2 100644
--- a/cvp_checks/tests/test_default_gateway.py
+++ b/cvp_checks/tests/test_default_gateway.py
@@ -1,15 +1,16 @@
import json
import pytest
-
+import os
from cvp_checks import utils
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_check_default_gateways(local_salt_client, group):
- config = utils.get_configuration(__file__)
+ if "skipped" in group:
+ pytest.skip("skipped in config")
netstat_info = local_salt_client.cmd(
group, 'cmd.run', ['ip r | sed -n 1p'], expr_form='pcre')
diff --git a/cvp_checks/tests/test_mtu.py b/cvp_checks/tests/test_mtu.py
index f3c3511..be17237 100644
--- a/cvp_checks/tests/test_mtu.py
+++ b/cvp_checks/tests/test_mtu.py
@@ -1,14 +1,17 @@
import pytest
import json
from cvp_checks import utils
+import os
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_mtu(local_salt_client, group):
- config = utils.get_configuration(__file__)
+ if "skipped" in group:
+ pytest.skip("skipped in config")
+ config = utils.get_configuration()
skipped_ifaces = config["skipped_ifaces"]
total = {}
network_info = local_salt_client.cmd(
diff --git a/cvp_checks/tests/test_ntp_sync.py b/cvp_checks/tests/test_ntp_sync.py
index 10eb130..b900e12 100644
--- a/cvp_checks/tests/test_ntp_sync.py
+++ b/cvp_checks/tests/test_ntp_sync.py
@@ -1,21 +1,25 @@
from cvp_checks import utils
+import os
def test_ntp_sync(local_salt_client):
- config = utils.get_configuration(__file__)
+ testname = os.path.basename(__file__).split('.')[0]
+ active_nodes = utils.get_active_nodes(os.path.basename(__file__))
+ config = utils.get_configuration()
fail = {}
saltmaster_time = int(local_salt_client.cmd(
'salt:master',
'cmd.run',
['date +%s'],
expr_form='pillar').values()[0])
-
nodes_time = local_salt_client.cmd(
- '*', 'cmd.run', ['date +%s'])
-
+ utils.list_to_target_string(active_nodes, 'or'),
+ 'cmd.run',
+ ['date +%s'],
+ expr_form='compound')
for node, time in nodes_time.iteritems():
- if (int(time) - saltmaster_time) > config["time_deviation"] or \
- (int(time) - saltmaster_time) < -config["time_deviation"]:
+ if (int(time) - saltmaster_time) > config.get(testname)["time_deviation"] or \
+ (int(time) - saltmaster_time) < -config.get(testname)["time_deviation"]:
fail[node] = time
assert not fail, 'SaltMaster time: {}\n' \
diff --git a/cvp_checks/tests/test_packet_checker.py b/cvp_checks/tests/test_packet_checker.py
index 79915ec..2556bcf 100644
--- a/cvp_checks/tests/test_packet_checker.py
+++ b/cvp_checks/tests/test_packet_checker.py
@@ -1,15 +1,16 @@
import pytest
import json
+import os
from cvp_checks import utils
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_check_package_versions(local_salt_client, group):
- config = utils.get_configuration(__file__)
-
+ if "skipped" in group:
+ pytest.skip("skipped in config")
output = local_salt_client.cmd(group, 'lowpkg.list_pkgs', expr_form='pcre')
if len(output.keys()) < 2:
@@ -43,11 +44,11 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_check_module_versions(local_salt_client, group):
- config = utils.get_configuration(__file__)
-
+ if "skipped" in group:
+ pytest.skip("skipped in config")
pre_check = local_salt_client.cmd(
group, 'cmd.run', ['dpkg -l | grep "python-pip "'], expr_form='pcre')
if pre_check.values().count('') > 0:
diff --git a/cvp_checks/tests/test_repo_list.py b/cvp_checks/tests/test_repo_list.py
index 0970fdc..bd3214c 100644
--- a/cvp_checks/tests/test_repo_list.py
+++ b/cvp_checks/tests/test_repo_list.py
@@ -1,12 +1,15 @@
import pytest
+import os
from cvp_checks import utils
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_list_of_repo_on_nodes(local_salt_client, group):
+ if "skipped" in group:
+ pytest.skip("skipped in config")
info_salt = local_salt_client.cmd(
group, 'pillar.data', ['linux:system:repo'], expr_form='pcre')
diff --git a/cvp_checks/tests/test_services.py b/cvp_checks/tests/test_services.py
index 3d90218..7f04578 100644
--- a/cvp_checks/tests/test_services.py
+++ b/cvp_checks/tests/test_services.py
@@ -1,15 +1,16 @@
import pytest
import json
+import os
from cvp_checks import utils
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_check_services(local_salt_client, group):
- config = utils.get_configuration(__file__)
-
+ if "skipped" in group:
+ pytest.skip("skipped in config")
output = local_salt_client.cmd(group, 'service.get_all', expr_form='pcre')
if len(output.keys()) < 2:
diff --git a/cvp_checks/tests/test_single_vip.py b/cvp_checks/tests/test_single_vip.py
index 9e0f16e..60d1894 100644
--- a/cvp_checks/tests/test_single_vip.py
+++ b/cvp_checks/tests/test_single_vip.py
@@ -1,13 +1,16 @@
import pytest
from cvp_checks import utils
+import os
from collections import Counter
@pytest.mark.parametrize(
"group",
- utils.get_groups(utils.get_configuration(__file__))
+ utils.get_groups(os.path.basename(__file__))
)
def test_single_vip(local_salt_client, group):
+ if "skipped" in group:
+ pytest.skip("skipped in config")
local_salt_client.cmd(group, 'saltutil.sync_all', expr_form='pcre')
nodes_list = local_salt_client.cmd(
group, 'grains.item', ['ipv4'], expr_form='pcre')