Skip to content

[chassis] accomodate test_memory_exhaustion.py if random dut is chassis sup #9075

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

Merged
merged 12 commits into from
Aug 3, 2023

Conversation

wenyiz2021
Copy link
Contributor

@wenyiz2021 wenyiz2021 commented Jul 21, 2023

Description of PR

There are 2 fixes in this PR to enhance for chassis:

  1. Right now in processes_utils.py when check_critical_services, we rely on what is pre-defined in inventory file, otherwise it is 300 sec, but for SUP, we should give 900sec as most SUPs have 10+ dockers that need to come back up, it should differ from linecards or any single-dut. magic 900 sec comes from experientment, where I had run twice the test, 1st time need 800+sec, 2nd time needs ~702sec
  2. During memory exhaustion test, if the random selected dut is chassis SUP, we also need to check linecards bootup and critical services are up.

Summary:
Fixes # (issue)
#9087

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?

How did you do it?

How did you verify/test it?

Any platform specific information?

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

Documentation

@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/platform_tests/test_memory_exhaustion.py:51:21: F821 undefined name 'check_interfaces_and_services'
tests/platform_tests/test_memory_exhaustion.py:51:55: F821 undefined name 'interfaces'
tests/platform_tests/test_memory_exhaustion.py:51:67: F821 undefined name 'xcvr_skip_list'
tests/platform_tests/test_memory_exhaustion.py:52:63: F821 undefined name 'reboot_type'

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>

@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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_memory_exhaustion.py

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/test_memory_exhaustion.py:53:79: F821 undefined name 'reboot_type'

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>

@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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_memory_exhaustion.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
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>

@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/platform_tests/test_memory_exhaustion.py:54:5: E303 too many blank lines (2)
tests/platform_tests/test_memory_exhaustion.py:85:51: F821 undefined name 'conn_graph_facts'

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>

@wenyiz2021 wenyiz2021 changed the title Update test_memory_exhaustion.py [chassis] accomodate test_memory_exhaustion.py if rand due is chassis sup Jul 21, 2023
@wenyiz2021 wenyiz2021 requested a review from arlakshm July 21, 2023 18:49
@wenyiz2021 wenyiz2021 marked this pull request as ready for review July 21, 2023 18:49
@wenyiz2021 wenyiz2021 requested a review from prgeor as a code owner July 21, 2023 18:49
@wenyiz2021 wenyiz2021 changed the title [chassis] accomodate test_memory_exhaustion.py if rand due is chassis sup [chassis] accomodate test_memory_exhaustion.py if random due is chassis sup Jul 21, 2023
@wenyiz2021 wenyiz2021 changed the title [chassis] accomodate test_memory_exhaustion.py if random due is chassis sup [chassis] accomodate test_memory_exhaustion.py if random dut is chassis sup Jul 21, 2023
@kenneth-arista
Copy link
Contributor

#9087

@@ -24,7 +24,8 @@ class TestMemoryExhaustion:
"""

@pytest.fixture(autouse=True)
def tearDown(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, pdu_controller):
def tearDown(self, duthosts, enum_rand_one_per_hwsku_hostname,
localhost, pdu_controller,):
Copy link
Contributor

@arlakshm arlakshm Jul 26, 2023

Choose a reason for hiding this comment

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

remove extra comma at end #Closed

Copy link
Contributor

Choose a reason for hiding this comment

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

also fix the line indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the comma.
Indentation is correct I believe:

xcvr_skip_list, conn_graph_facts, shutdown_ebgp): # noqa F811

Comment on lines 45 to 50
# For sup, we also need to ensure linecards are back and healthy for following tests
is_sup = duthost.get_facts().get("modular_chassis") and duthost.is_supervisor_node()
if is_sup:
for lc in duthosts.frontend_nodes:
wait_for_startup(lc, localhost, delay=10, timeout=300)
wait_critical_processes(lc)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we write commmon function for this code, it is being used couple time here may be useful in other tests as well

@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/platform_tests/test_memory_exhaustion.py:30:38: F821 undefined name 'localhost'
tests/platform_tests/test_memory_exhaustion.py:52:13: F821 undefined name 'wait_lc_healthy_if_sup'
tests/platform_tests/test_memory_exhaustion.py:80:9: F821 undefined name 'wait_lc_healthy_if_sup'

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>

@wenyiz2021 wenyiz2021 requested a review from arlakshm July 31, 2023 20:31
@arlakshm
Copy link
Contributor

class TestMemoryExhaustion:

same as above


Refers to: tests/platform_tests/test_memory_exhaustion.py:21 in 8505fe6. [](commit_id = 8505fe6, deletion_comment = False)

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202205: #9295

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #9329

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.

6 participants