Add new group collecting mechanism
diff --git a/cvp_checks/tests/test_default_gateway.py b/cvp_checks/tests/test_default_gateway.py
index b6c74c2..cac5328 100644
--- a/cvp_checks/tests/test_default_gateway.py
+++ b/cvp_checks/tests/test_default_gateway.py
@@ -6,13 +6,11 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
def test_check_default_gateways(local_salt_client, group):
- 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')
+ "L@"+','.join(utils.node_groups[group]), 'cmd.run', ['ip r | sed -n 1p'], expr_form='compound')
gateways = {}
nodes = netstat_info.keys()
diff --git a/cvp_checks/tests/test_mtu.py b/cvp_checks/tests/test_mtu.py
index 8d76cef..53d9dba 100644
--- a/cvp_checks/tests/test_mtu.py
+++ b/cvp_checks/tests/test_mtu.py
@@ -6,18 +6,16 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
def test_mtu(local_salt_client, group):
testname = os.path.basename(__file__).split('.')[0]
- if "skipped" in group:
- pytest.skip("skipped in config")
config = utils.get_configuration()
skipped_ifaces = config.get(testname)["skipped_ifaces"] or \
["bonding_masters", "lo", "veth", "tap", "cali"]
total = {}
network_info = local_salt_client.cmd(
- group, 'cmd.run', ['ls /sys/class/net/'], expr_form='pcre')
+ "L@"+','.join(utils.node_groups[group]), 'cmd.run', ['ls /sys/class/net/'], expr_form='compound')
kvm_nodes = local_salt_client.cmd(
'salt:control', 'test.ping', expr_form='pillar').keys()
diff --git a/cvp_checks/tests/test_packet_checker.py b/cvp_checks/tests/test_packet_checker.py
index 2556bcf..d85e87e 100644
--- a/cvp_checks/tests/test_packet_checker.py
+++ b/cvp_checks/tests/test_packet_checker.py
@@ -6,12 +6,10 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
def test_check_package_versions(local_salt_client, group):
- if "skipped" in group:
- pytest.skip("skipped in config")
- output = local_salt_client.cmd(group, 'lowpkg.list_pkgs', expr_form='pcre')
+ output = local_salt_client.cmd("L@"+','.join(utils.node_groups[group]), 'lowpkg.list_pkgs', expr_form='compound')
if len(output.keys()) < 2:
pytest.skip("Nothing to compare - only 1 node")
@@ -44,18 +42,16 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
def test_check_module_versions(local_salt_client, group):
- 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')
+ "L@"+','.join(utils.node_groups[group]), 'cmd.run', ['dpkg -l | grep "python-pip "'], expr_form='compound')
if pre_check.values().count('') > 0:
pytest.skip("pip is not installed on one or more nodes")
if len(pre_check.keys()) < 2:
pytest.skip("Nothing to compare - only 1 node")
- output = local_salt_client.cmd(group, 'pip.freeze', expr_form='pcre')
+ output = local_salt_client.cmd("L@"+','.join(utils.node_groups[group]), 'pip.freeze', expr_form='compound')
nodes = []
pkts_data = []
diff --git a/cvp_checks/tests/test_repo_list.py b/cvp_checks/tests/test_repo_list.py
index 07f16d0..c29bb7f 100644
--- a/cvp_checks/tests/test_repo_list.py
+++ b/cvp_checks/tests/test_repo_list.py
@@ -5,13 +5,13 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
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')
+ "L@"+','.join(utils.node_groups[group]), 'pillar.data', ['linux:system:repo'], expr_form='compound')
raw_actual_info = local_salt_client.cmd(
group,
diff --git a/cvp_checks/tests/test_services.py b/cvp_checks/tests/test_services.py
index 7f04578..be0bc16 100644
--- a/cvp_checks/tests/test_services.py
+++ b/cvp_checks/tests/test_services.py
@@ -6,12 +6,10 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
def test_check_services(local_salt_client, group):
- if "skipped" in group:
- pytest.skip("skipped in config")
- output = local_salt_client.cmd(group, 'service.get_all', expr_form='pcre')
+ output = local_salt_client.cmd("L@"+','.join(utils.node_groups[group]), 'service.get_all', expr_form='compound')
if len(output.keys()) < 2:
pytest.skip("Nothing to compare - only 1 node")
diff --git a/cvp_checks/tests/test_single_vip.py b/cvp_checks/tests/test_single_vip.py
index 60d1894..d829a1a 100644
--- a/cvp_checks/tests/test_single_vip.py
+++ b/cvp_checks/tests/test_single_vip.py
@@ -6,12 +6,10 @@
@pytest.mark.parametrize(
"group",
- utils.get_groups(os.path.basename(__file__))
+ utils.node_groups.keys()
)
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')
+ local_salt_client.cmd("L@"+','.join(utils.node_groups[group]), 'saltutil.sync_all', expr_form='compound')
nodes_list = local_salt_client.cmd(
group, 'grains.item', ['ipv4'], expr_form='pcre')