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

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take 45 seconds. #12914

Conversation

liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented May 21, 2024

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

Why I did it

Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run L0071 DEBUG | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run L0108 DEBUG | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

Work item tracking
  • Microsoft ADO: 27683903

How I did it

Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

How to verify it

Pass all test case.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@liuh-80 liuh-80 marked this pull request as ready for review May 21, 2024 07:31
@liuh-80 liuh-80 requested a review from qiluo-msft May 21, 2024 07:31
@liuh-80 liuh-80 changed the title Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time. Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take 45 seconds. May 21, 2024
@@ -64,7 +64,7 @@ def hash_and_timestamp_changed(duthost, file):
latest_timestamp = get_interface_reload_timestamp(duthost)
return latest_hash != original_hash and latest_timestamp != last_timestamp

exist = wait_until(10, 1, 0, hash_and_timestamp_changed, duthost, file)
exist = wait_until(60, 1, 0, hash_and_timestamp_changed, duthost, file)
pytest_assert(exist, "File {} does not change after 10 seconds.".format(file))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10

Conflicting message. Suggest use constant variable. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@qiluo-msft
Copy link
Contributor

                    "/etc/network/interfaces",

What is your real waiting goal? Like eth0 having some expected attribute? Is it possible to wait for the real goal?


Refers to: tests/route/test_forced_mgmt_route.py:153 in 6ae8d21. [](commit_id = 6ae8d21, deletion_comment = False)

@qiluo-msft qiluo-msft requested a review from wangxin May 21, 2024 21:31
@qiluo-msft
Copy link
Contributor

qiluo-msft commented May 21, 2024

is it a typo "405 seconds"? #Closed

@qiluo-msft qiluo-msft requested a review from prsunny May 21, 2024 21:32
@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/route/test_forced_mgmt_route.py:26:1: E302 expected 2 blank lines, found 1

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 22, 2024

                    "/etc/network/interfaces",

What is your real waiting goal? Like eth0 having some expected attribute? Is it possible to wait for the real goal?

Refers to: tests/route/test_forced_mgmt_route.py:153 in 6ae8d21. [](commit_id = 6ae8d21, deletion_comment = False)

After forced mgmt route change, hostcfgd will trigger 'interfaces-config' service to update /etc/network/interfaces.
Test case need wait for interface config update finish.

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 22, 2024

is it a typo "405 seconds"?

Fixed, typo.

prsunny
prsunny previously approved these changes May 22, 2024
@qiluo-msft qiluo-msft merged commit c35beef into sonic-net:master May 28, 2024
14 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request May 29, 2024
…atus with systemctl take 45 seconds. (sonic-net#12914)

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

#### Why I did it
Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

##### Work item tracking
- Microsoft ADO: 27683903

#### How I did it
Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

#### How to verify it
Pass all test case.

#### Description for the changelog
Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request May 29, 2024
…atus with systemctl take 45 seconds. (sonic-net#12914)

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

#### Why I did it
Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

##### Work item tracking
- Microsoft ADO: 27683903

#### How I did it
Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

#### How to verify it
Pass all test case.

#### Description for the changelog
Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #13027

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #13028

mssonicbld pushed a commit that referenced this pull request May 29, 2024
…atus with systemctl take 45 seconds. (#12914)

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

#### Why I did it
Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

##### Work item tracking
- Microsoft ADO: 27683903

#### How I did it
Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

#### How to verify it
Pass all test case.

#### Description for the changelog
Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.
mssonicbld pushed a commit that referenced this pull request May 29, 2024
…atus with systemctl take 45 seconds. (#12914)

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

#### Why I did it
Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

##### Work item tracking
- Microsoft ADO: 27683903

#### How I did it
Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

#### How to verify it
Pass all test case.

#### Description for the changelog
Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.
zjswhhh pushed a commit to zjswhhh/sonic-mgmt that referenced this pull request May 29, 2024
…atus with systemctl take 45 seconds. (sonic-net#12914)

Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.

#### Why I did it
Check interfaces-config status with systemctl some times take 45 seconds, however the wait timeout is 10 seconds, which cause test case break:

13/05/2024 23:01:03 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command, args=["sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value"], kwargs={}

13/05/2024 23:01:45 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt_vms21-t0-2700_646f1402735219c3e5444094/tests/common/devices/multi_asic.py::_run_on_asics#128: [] AnsibleModule::command Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": ["sudo", "systemctl", "show", "--no-pager", "interfaces-config", "-p", "ExecMainExitTimestamp", "--value"], "start": "2024-05-13 23:01:00.605392", "end": "2024-05-13 23:01:00.682419", "delta": "0:00:00.077027", "msg": "", "invocation": {"module_args": {"_raw_params": "sudo systemctl show --no-pager interfaces-config -p ExecMainExitTimestamp --value", "_uses_shell": false, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}

##### Work item tracking
- Microsoft ADO: 27683903

#### How I did it
Increase wait timeout to 60 seconds, because the some time the check status command take 45 seconds.

#### How to verify it
Pass all test case.

#### Description for the changelog
Fix test_update_forced_mgmt failed because check interfaces-config status with systemctl take too much time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants