From a02991ce1f1f05cf53ab5dc1bb835bd2867507dd Mon Sep 17 00:00:00 2001 From: Zhaohui Sun <94606222+ZhaohuiS@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:22:26 +0800 Subject: [PATCH] Skip test_passwd_hardening in tests_mark_conditions.yaml (#6429) What is the motivation for this PR? test_passw_hardening is unable to run on master image because sonic-net/sonic-buildimage#12138 hasn't been merged. But after running it on 202205 image which supports passw-harden(enabled in this PR sonic-net/sonic-buildimage#12025), found an issue and raised here #6428. I think that it's better to skip test case in tests_mark_conditions.yaml instead of in test script. How did you do it? Move skip condition to tests_mark_conditions.yaml Add an issue in skip condition. After it's been fixed, we can run this script. How did you verify/test it? Run passw_hardening/test_passw_hardening.py Signed-off-by: Zhaohui Sun --- .../conditional_mark/tests_mark_conditions.yaml | 10 ++++++++++ tests/passw_hardening/conftest.py | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml index 6845ddcd018..5194bf58094 100644 --- a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml +++ b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml @@ -417,6 +417,16 @@ ntp/test_ntp.py::test_ntp_long_jump_disabled: strict: True reason: "Known NTP bug" +####################################### +##### passw_hardening ##### +####################################### +passw_hardening/test_passw_hardening.py: + skip: + reason: "Password-hardening supported just in master version" + conditions: + - "release not in ['master']" + - https://github.com/sonic-net/sonic-mgmt/issues/6428 + ####################################### ##### pc ##### ####################################### diff --git a/tests/passw_hardening/conftest.py b/tests/passw_hardening/conftest.py index 5fa7cbcf97f..a78d6dd014a 100644 --- a/tests/passw_hardening/conftest.py +++ b/tests/passw_hardening/conftest.py @@ -17,12 +17,6 @@ def set_default_passw_hardening_policies(duthosts, enum_rand_one_per_hwsku_hostn test_passw_hardening.config_and_review_policies(duthost, passw_hardening_ob_dis, test_passw_hardening.PAM_PASSWORD_CONF_DEFAULT_EXPECTED) -@pytest.fixture(scope="module", autouse=True) -def passw_version_required(duthosts, enum_rand_one_per_hwsku_hostname): - duthost = duthosts[enum_rand_one_per_hwsku_hostname] - if not "master" in duthost.os_version: - pytest.skip("Password-hardening supported just in master version") - @pytest.fixture(scope="function") def clean_passw_policies(duthosts, enum_rand_one_per_hwsku_hostname): yield