first commit!
diff --git a/cvp_checks/tests/test_services.py b/cvp_checks/tests/test_services.py
new file mode 100644
index 0000000..3d90218
--- /dev/null
+++ b/cvp_checks/tests/test_services.py
@@ -0,0 +1,41 @@
+import pytest
+import json
+from cvp_checks import utils
+
+
+@pytest.mark.parametrize(
+ "group",
+ utils.get_groups(utils.get_configuration(__file__))
+)
+def test_check_services(local_salt_client, group):
+ config = utils.get_configuration(__file__)
+
+ output = local_salt_client.cmd(group, 'service.get_all', expr_form='pcre')
+
+ if len(output.keys()) < 2:
+ pytest.skip("Nothing to compare - only 1 node")
+
+ nodes = []
+ pkts_data = []
+ my_set = set()
+
+ for node in output:
+ nodes.append(node)
+ my_set.update(output[node])
+
+ for srv in my_set:
+ diff = []
+ row = []
+ for node in nodes:
+ if srv in output[node]:
+ diff.append(srv)
+ row.append("{}: +".format(node))
+ else:
+ row.append("{}: No service".format(node))
+ if diff.count(diff[0]) < len(nodes):
+ row.sort()
+ row.insert(0, srv)
+ pkts_data.append(row)
+ assert len(pkts_data) <= 1, \
+ "Several problems found for {0} group: {1}".format(
+ group, json.dumps(pkts_data, indent=4))