Add tests to run cvp-func and cvp-sanity jobs
New pytest marks:
- run_cvp_func_smoke
- run_cvp_func_sanity
New SaltManager method:
- get_single_pillar() , to get a single value from
a single minion
Minor changes to get_jenkins_job_stages.py and
run_jenkins_job.py, to call them with required
parameters.
Closes-Bug: PROD-21659
Change-Id: Ie8beec0297f1c2625440f01d781c17779977b818
diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
index 8ef817a..1e1640f 100644
--- a/tcp_tests/managers/saltmanager.py
+++ b/tcp_tests/managers/saltmanager.py
@@ -167,6 +167,24 @@
result = self.local(tgt=tgt, fun='pillar.get', args=pillar)
return result['return']
+ def get_single_pillar(self, tgt, pillar):
+ """Get a scalar value from a single node
+
+ :return: pillar value
+ """
+
+ result = self.get_pillar(tgt, pillar)
+ nodes = result[0].keys()
+
+ if not nodes:
+ raise LookupError("No minions selected "
+ "for the target '{0}'".format(tgt))
+ if len(nodes) > 1:
+ raise LookupError("Too many minions selected "
+ "for the target '{0}' , expected one: {1}"
+ .format(tgt, nodes))
+ return result[0][nodes[0]]
+
def get_grains(self, tgt, grains):
result = self.local(tgt=tgt, fun='grains.get', args=grains)
return result['return']