From 47dbed1df3e6959f6cbb194ed8ed7a2347ce9b57 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Thu, 31 Aug 2023 05:14:29 -0700 Subject: [PATCH] Skip test_secure_upgrade.py if current image is not secured. (#9747) What I did: Skip the test tests/platform_tests/test_secure_upgrade.py if the current install image is not secured image. ADO: 24319390 How I verify: Manually Run the test case on image having this change : sonic-net/sonic-buildimage#16191What I did: Skip the test tests/platform_tests/test_secure_upgrade.py if the current install image is not secured image. ADO: 24319390 How I verify: Manually Run the test case on image having this change : sonic-net/sonic-buildimage#16191 --- tests/platform_tests/test_secure_upgrade.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/platform_tests/test_secure_upgrade.py b/tests/platform_tests/test_secure_upgrade.py index 7146de6c54..4038c76616 100644 --- a/tests/platform_tests/test_secure_upgrade.py +++ b/tests/platform_tests/test_secure_upgrade.py @@ -38,7 +38,7 @@ def keep_same_version_installed(duthost): pytest_assert(len(results) > 0, "Current image is empty!") current_version = results[0] yield - duthost.shell("sudo sonic-installer set-default {}", format(current_version)) + duthost.shell("sudo sonic-installer set-default {}".format(current_version)) @pytest.fixture(scope='session') @@ -55,6 +55,11 @@ def test_non_secure_boot_upgrade_failure(duthost, non_secure_image_path, tbinfo) """ @summary: This test case validates non successful upgrade of a given non secure image """ + secure_boot_image = duthost.command("sonic-cfggen -y /etc/sonic/sonic_version.yml -v secure_boot_image")['stdout'] + + if secure_boot_image != 'yes': + pytest.skip("Current Image is not secured so skipping") + # install non secure image logger.info("install non secure image - expect fail, image path = {}".format(non_secure_image_path)) result = "image install failure" # because we expect fail