Skip to content

Fix for PID assertion issue - PSUD and CHASSID platform cases#7781

Merged
wenyiz2021 merged 2 commits intosonic-net:masterfrom
sanjair-git:pid-check
Jun 23, 2023
Merged

Fix for PID assertion issue - PSUD and CHASSID platform cases#7781
wenyiz2021 merged 2 commits intosonic-net:masterfrom
sanjair-git:pid-check

Conversation

@sanjair-git
Copy link
Copy Markdown
Contributor

Description of PR

Fixing up other chassisd and psud platform tests to poll for deamon to restart with bigger pid than before.
This is an extension of PR #7150.
Summary:
Fixes # (issue)

  • Fixes PSUD 'stop & start', 'term & start' and 'kill & start' test cases by making sure the daemon restarted has bigger PID than before.
  • Fixes CHASSID 'stop & start' and 'kill & start' test cases by making sure the daemon restarted has bigger PID than before.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

  • Currently PSUD and CHASSID platform test cases like 'term & start', 'kill & start' and 'stop & start' don't check if the restarted daemon has bigger pid than the previous one or not.
  • Currently "check_expected_daemon_status" doesn't verify about pre-daemon-pid, just returns TRUE even if the status is RUNNING with old PID.

How did you do it?

  • By invoking 'check_if_daemon_restarted' method on the above-mentioned cases and making sure the new pid is bigger than the old pid.

pmon_psud_chassid_results

How did you verify/test it?

  • Ran the respective platform tests against a multi-asic line card in a T2 chassis.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@sanjair-git sanjair-git requested a review from prgeor as a code owner March 17, 2023 21:22
@mssonicbld
Copy link
Copy Markdown
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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/platform_tests/daemon/test_chassisd.py:16:1: F401 'tests.common.platform.processes_utils.wait_critical_processes' imported but unused
tests/platform_tests/daemon/test_chassisd.py:17:1: F401 'tests.common.utilities.skip_release' imported but unused
tests/platform_tests/daemon/test_chassisd.py:37:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_chassisd.py:42:21: F523 '...'.format(...) has unused arguments at position(s): 2
tests/platform_tests/daemon/test_chassisd.py:51:8: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
tests/platform_tests/daemon/test_chassisd.py:62:8: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
tests/platform_tests/daemon/test_chassisd.py:66:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_chassisd.py:70:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_chassisd.py:74:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_chassisd.py:84:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_chassisd.py:87:5: E306 expected 1 blank line before a nested definition, found 0
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

@mssonicbld
Copy link
Copy Markdown
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/platform_tests/daemon/test_psud.py:71:1: E302 expected 2 blank lines, found 1
tests/platform_tests/daemon/test_psud.py:75:1: E302 expected 2 blank lines, found 1

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>

sanmalho-git and others added 2 commits May 31, 2023 10:43
Fix for PID assertion - Typo Error

Fixing up other chassisd and psud tests to poll for deamon to restart with bigger pid than before
Copy link
Copy Markdown
Contributor

@wenyiz2021 wenyiz2021 left a comment

Choose a reason for hiding this comment

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

LGTM

@mssonicbld
Copy link
Copy Markdown
Collaborator

@sanjair-git PR conflicts with 202205 branch

sanjair-git added a commit to sanjair-git/sonic-mgmt that referenced this pull request Jun 29, 2023
…net#7781)

Fix for PID assertion issue - PSUD and CHASSID platform cases
Fixing up other chassisd and psud tests to poll for deamon to restart with bigger pid than before
---------

Co-authored-by: sanmalho <sandeep.malhotra@nokia.com>
yejianquan pushed a commit that referenced this pull request Jul 7, 2023
…#8776)

Fix for PID assertion issue - PSUD and CHASSID platform cases
Fixing up other chassisd and psud tests to poll for deamon to restart with bigger pid than before
---------
Cherry-Pick PR #7781 : For resolving conflicts.
Fix for PID assertion issue - PSUD and CHASSID platform cases.

Description of PR
Fixing up other chassisd and psud platform tests to poll for deamon to restart with bigger pid than before.
This is an extension of PR #7150.

Summary:
Fixes # (issue)

Fixes PSUD 'stop & start', 'term & start' and 'kill & start' test cases by making sure the daemon restarted has bigger PID than before.
Fixes CHASSID 'stop & start' and 'kill & start' test cases by making sure the daemon restarted has bigger PID than before.

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 Test case(new/improvement)
Back port request
 201911
 202012
 202205
Approach
What is the motivation for this PR?
Currently PSUD and CHASSID platform test cases like 'term & start', 'kill & start' and 'stop & start' don't check if the restarted daemon has bigger pid than the previous one or not.
Currently "check_expected_daemon_status" doesn't verify about pre-daemon-pid, just returns TRUE even if the status is RUNNING with old PID.
How did you do it?
By invoking 'check_if_daemon_restarted' method on the above-mentioned cases and making sure the new pid is bigger than the old pid.
How did you verify/test it?
Ran the respective platform tests against a multi-asic line card in a T2 chassis.

Co-authored-by: sanmalho <sandeep.malhotra@nokia.com>, jianquanye@microsoft.com
mrkcmo pushed a commit to Azarack/sonic-mgmt that referenced this pull request Oct 3, 2023
…net#7781)

Fix for PID assertion issue - PSUD and CHASSID platform cases
Fixing up other chassisd and psud tests to poll for deamon to restart with bigger pid than before
---------

Co-authored-by: sanmalho <sandeep.malhotra@nokia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
…net#7781)

Fix for PID assertion issue - PSUD and CHASSID platform cases
Fixing up other chassisd and psud tests to poll for deamon to restart with bigger pid than before
---------

Co-authored-by: sanmalho <sandeep.malhotra@nokia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants