[CVP] Fix test_jenkins_jobs_branch according to new MCP updates logic
Related-PROD: PROD-28868
Change-Id: If7e845750c229f18ff47c6b815674e504b05c525
diff --git a/cvp-sanity/cvp_checks/tests/test_drivetrain.py b/cvp-sanity/cvp_checks/tests/test_drivetrain.py
index 481911a..f232909 100644
--- a/cvp-sanity/cvp_checks/tests/test_drivetrain.py
+++ b/cvp-sanity/cvp_checks/tests/test_drivetrain.py
@@ -286,12 +286,16 @@
def test_jenkins_jobs_branch(local_salt_client):
+ """ This test compares Jenkins jobs versions
+ collected from the cloud vs collected from pillars.
+ """
excludes = ['upgrade-mcp-release', 'deploy-update-salt']
config = utils.get_configuration()
drivetrain_version = config.get('drivetrain_version', '')
if not drivetrain_version:
pytest.skip("drivetrain_version is not defined. Skipping")
+
jenkins_password = get_password(local_salt_client, 'jenkins:client')
version_mismatch = []
server = join_to_jenkins(local_salt_client, 'admin', jenkins_password)
@@ -310,13 +314,18 @@
if drivetrain_version in ['testing','nightly','stable']:
expected_version = 'master'
else:
- expected_version = drivetrain_version
+ expected_version = local_salt_client.cmd(
+ 'I@gerrit:client',
+ 'pillar.get',
+ ['jenkins:client:job:{}:scm:branch'.format(job_name)],
+ expr_form='compound').values()[0]
if not BranchSpec:
print("No BranchSpec has found for {} job".format(job_name))
continue
actual_version = BranchSpec[0].getElementsByTagName('name')[0].childNodes[0].data
+
if (actual_version not in [expected_version, "release/{}".format(drivetrain_version)]):
version_mismatch.append("Job {0} has {1} branch."
"Expected {2}".format(job_name,