Add job to test cvp-spt
PROD-36018
Change-Id: I143b062fc8b8c30f0ff2225fe4c7173ff2a6f8c8
diff --git a/tcp_tests/tests/system/test_cvp_pipelines.py b/tcp_tests/tests/system/test_cvp_pipelines.py
index 1523c48..3f89586 100644
--- a/tcp_tests/tests/system/test_cvp_pipelines.py
+++ b/tcp_tests/tests/system/test_cvp_pipelines.py
@@ -421,3 +421,73 @@
except jenkins.NotFoundException:
raise jenkins.NotFoundException("{0}\n{1}".format(
description, '\n'.join(stages)))
+
+ @pytest.mark.grab_versions
+ @pytest.mark.parametrize("_", [settings.ENV_NAME])
+ @pytest.mark.run_cvp_spt
+ def test_run_cvp_spt(self, salt_actions, show_step, _):
+ """Runner for Pipeline CVP - Functional tests
+
+ Scenario:
+ 1. Get CICD Jenkins access credentials from salt
+ 2. Run job cvp-spt
+ 3. Get passed stages from cvp-spt
+ """
+ salt = salt_actions
+ show_step(1)
+
+ tgt = 'I@docker:client:stack:jenkins and cid01*'
+ jenkins_host = salt.get_single_pillar(
+ tgt=tgt, pillar="jenkins:client:master:host")
+ jenkins_port = salt.get_single_pillar(
+ tgt=tgt, pillar="jenkins:client:master:port")
+ jenkins_protocol = salt.get_single_pillar(
+ tgt=tgt, pillar="jenkins:client:master:proto")
+ jenkins_url = '{0}://{1}:{2}'.format(jenkins_protocol,
+ jenkins_host,
+ jenkins_port)
+ jenkins_user = salt.get_single_pillar(
+ tgt=tgt, pillar="jenkins:client:master:username")
+ jenkins_pass = salt.get_single_pillar(
+ tgt=tgt, pillar="jenkins:client:master:password")
+ jenkins_start_timeout = 60
+ jenkins_build_timeout = 1800
+
+ job_name = 'cvp-spt'
+
+ job_parameters = {
+ 'EXTRA_PARAMS': (
+ """
+ envs:
+ - tests_set=''
+ - image_name=TestCirros-0.4.0
+ - networks=10.6.0.0/24
+ """),
+ }
+
+ show_step(2)
+ cvp_spt_result = run_jenkins_job.run_job(
+ host=jenkins_url,
+ username=jenkins_user,
+ password=jenkins_pass,
+ start_timeout=jenkins_start_timeout,
+ build_timeout=jenkins_build_timeout,
+ verbose=True,
+ job_name=job_name,
+ job_parameters=job_parameters,
+ job_output_prefix='[ cvp-func/{build_number}:platform {time} ] ')
+
+ show_step(3)
+ (description, stages) = get_jenkins_job_stages.get_deployment_result(
+ host=jenkins_url,
+ username=jenkins_user,
+ password=jenkins_pass,
+ job_name=job_name,
+ build_number='lastBuild')
+
+ LOG.info(description)
+ LOG.info('\n'.join(stages))
+ LOG.info('Job {0} result: {1}'.format(job_name,
+ cvp_spt_result))
+ assert cvp_spt_result == 'SUCCESS', "{0}\n{1}".format(
+ description, '\n'.join(stages))