Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure for test_passw_hardening #6428

Closed
ZhaohuiS opened this issue Sep 28, 2022 · 4 comments
Closed

Test failure for test_passw_hardening #6428

ZhaohuiS opened this issue Sep 28, 2022 · 4 comments

Comments

@ZhaohuiS
Copy link
Contributor

Description

  1. test_passw_hardening failed because of these parameters in the case test_passw_hardening_history
    passw_hardening_ob = PasswHardening(state='enabled',
                                        expiration='0',
                                        expiration_warning='0',

It defines expiration=0 and expiration_warning=0 in case test_passw_hardening_history, but in yang module, it starts from 1, not from 0. That's why the command doesn't work. Please see the error message as below.

https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-passwh.yang#:~:text=type%20uint16%20%7B-,range%201..365%3B,-%7D

  1. Is it possible to disable passw-harden or clean related config whenever case passed or failed, in case of blocking access to testbed and blocking other test cases?
E           RunAnsibleModuleFail: run module command failed, Ansible Results =>
E           {
E               "changed": true, 
E               "cmd": [
E                   "sudo", 
E                   "config", 
E                   "passw-hardening", 
E                   "policies", 
E                   "expiration", 
E                   "0"
E               ], 
E               "delta": "0:00:01.862049", 
E               "end": "2022-09-28 05:38:24.984160", 
E               "failed": true, 
E               "invocation": {
E                   "module_args": {
E                       "_raw_params": "sudo config passw-hardening policies expiration 0", 
E                       "_uses_shell": false, 
E                       "argv": null, 
E                       "chdir": null, 
E                       "creates": null, 
E                       "executable": null, 
E                       "removes": null, 
E                       "stdin": null, 
E                       "stdin_add_newline": true, 
E                       "strip_empty_ends": true, 
E                       "warn": true
E                   }
E               }, 
E               "msg": "non-zero return code", 
E               "rc": 1, 
E               "start": "2022-09-28 05:38:23.122111", 
E               "stderr": "libyang[0]: Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern). (path: /sonic-passwh:sonic-passwh/PASSW_HARDENING/POLICIES/expiration)\nAborted!", 
E               "stderr_lines": [
E                   "libyang[0]: Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern). (path: /sonic-passwh:sonic-passwh/PASSW_HARDENING/POLICIES/expiration)", 
E                   "Aborted!"
E               ], 
E               "stdout": "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY\nsonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY\nsonic_yang(3):Data Loading Failed:Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).\nError: Failed to validate configuration: Data Loading Failed\nValue \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).", 
E               "stdout_lines": [
E                   "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY", 
E                   "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY", 
E                   "sonic_yang(3):Data Loading Failed:Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).", 
E                   "Error: Failed to validate configuration: Data Loading Failed", 
E                   "Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern)."
E               ], 
E               "warnings": [
E                   "Consider using 'become', 'become_method', and 'become_user' rather than running sudo"
E               ]
E           }

Steps to reproduce the issue:

  1. run passw_hardening/test_passw_hardening.py with 202205 image.

Describe the results you received:

Describe the results you expected:

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
@ZhaohuiS
Copy link
Contributor Author

@davidpil2002 Could you please take a look?

@davidpil2002
Copy link
Contributor

sure,
thanks

ZhaohuiS added a commit that referenced this issue Sep 29, 2022
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>
@davidpil2002
Copy link
Contributor

davidpil2002 commented Oct 4, 2022

Hi @ZhaohuiS ,
pls could you review and merge the fix: #6453 ?

ZhaohuiS added a commit that referenced this issue Oct 9, 2022
What is the motivation for this PR?
passw_hardening/test_passw_hardening.py should be ran on master image and with issue #6428 fixed.
Currently, issue #6428 is not fixed, the defulat logical operator is AND, so for master image, the final result is False, the case is not skipped.

How did you do it?
Change condition_logical_operator to OR, if the issue is fixed, it will run on master image, otherwise it will be skipped for all images.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
ZhaohuiS pushed a commit that referenced this issue Oct 16, 2022
What is the motivation for this PR?
Fix the issue #6428

How did you do it?
explained in the summary.

How did you verify/test it?
Run the test with the sonic-builimage build from branch 202205
command line:
py.test /sonic-mgmt/tests/passw_hardening/test_passw_hardening.py
@ZhaohuiS
Copy link
Contributor Author

Fixed in #6453

wangxin pushed a commit that referenced this issue Oct 17, 2022
What is the motivation for this PR?
Fix the issue #6428

How did you do it?
explained in the summary.

How did you verify/test it?
Run the test with the sonic-builimage build from branch 202205
command line:
py.test /sonic-mgmt/tests/passw_hardening/test_passw_hardening.py
Azarack pushed a commit to Azarack/sonic-mgmt that referenced this issue Oct 17, 2022
)

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 sonic-net#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>
Azarack pushed a commit to Azarack/sonic-mgmt that referenced this issue Oct 17, 2022
…net#6482)

What is the motivation for this PR?
passw_hardening/test_passw_hardening.py should be ran on master image and with issue sonic-net#6428 fixed.
Currently, issue sonic-net#6428 is not fixed, the defulat logical operator is AND, so for master image, the final result is False, the case is not skipped.

How did you do it?
Change condition_logical_operator to OR, if the issue is fixed, it will run on master image, otherwise it will be skipped for all images.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
allen-xf pushed a commit to allen-xf/sonic-mgmt that referenced this issue Oct 28, 2022
)

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 sonic-net#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>
allen-xf pushed a commit to allen-xf/sonic-mgmt that referenced this issue Oct 28, 2022
…net#6482)

What is the motivation for this PR?
passw_hardening/test_passw_hardening.py should be ran on master image and with issue sonic-net#6428 fixed.
Currently, issue sonic-net#6428 is not fixed, the defulat logical operator is AND, so for master image, the final result is False, the case is not skipped.

How did you do it?
Change condition_logical_operator to OR, if the issue is fixed, it will run on master image, otherwise it will be skipped for all images.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
allen-xf pushed a commit to allen-xf/sonic-mgmt that referenced this issue Oct 28, 2022
What is the motivation for this PR?
Fix the issue sonic-net#6428

How did you do it?
explained in the summary.

How did you verify/test it?
Run the test with the sonic-builimage build from branch 202205
command line:
py.test /sonic-mgmt/tests/passw_hardening/test_passw_hardening.py
wangxin pushed a commit that referenced this issue Jun 14, 2023
This PR removes the skip of password hardening test, as the issue #6428 is already fixed, and the test can run on 202205 and 202211 branches.

What is the motivation for this PR?
Remove the skip for password hardening test as the test can run on any branch (not only master)

How did you do it?
Removed the skip from test_mark_conditions.py
mrkcmo pushed a commit to Azarack/sonic-mgmt that referenced this issue Oct 3, 2023
This PR removes the skip of password hardening test, as the issue sonic-net#6428 is already fixed, and the test can run on 202205 and 202211 branches.

What is the motivation for this PR?
Remove the skip for password hardening test as the test can run on any branch (not only master)

How did you do it?
Removed the skip from test_mark_conditions.py
AharonMalkin added a commit to AharonMalkin/sonic-mgmt that referenced this issue Jan 25, 2024
This PR removes the skip of password hardening test, as the issue sonic-net#6428 is already fixed, and the test can run on 202205 and 202211 branches.

What is the motivation for this PR?
Remove the skip for password hardening test as the test can run on any branch (not only master)

How did you do it?
Removed the skip from test_mark_conditions.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants