Skip to content

Commit

Permalink
Skip test_passwd_hardening in tests_mark_conditions.yaml (#6429)
Browse files Browse the repository at this point in the history
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 <zhaohuisun@microsoft.com>
  • Loading branch information
ZhaohuiS authored Sep 29, 2022
1 parent c41f842 commit a02991c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 10 additions & 0 deletions tests/common/plugins/conditional_mark/tests_mark_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####
#######################################
Expand Down
6 changes: 0 additions & 6 deletions tests/passw_hardening/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a02991c

Please sign in to comment.