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

Adding new test case for default password change after initial boot #6863

Merged
merged 36 commits into from
Mar 17, 2023

Conversation

azmyali98
Copy link
Contributor

@azmyali98 azmyali98 commented Nov 21, 2022

Default password change after initial boot.

Description of PR

Summary:

According to a new law passed on California state, users are obligated to change default password to a new more sophisticated password. Passwords for default users such as 'admin' are no longer accepted and must be changed after initial boot.

Test Case:

We are introducing a new test case that validates expiring default passwords after initial boot of the image given to the test. In the test case, we take a path to a binary image from the parameter --restore_to_image that contains a new image to install. We install the given image from ONIE using 'onie-nos-install' and this manufacturing the switch to this new image, after the system is installed from ONIE we validate that the expiring message appears on the first login of the system, we configure a sophisticated password predefined in the test and validating the ability to login with this new password.

As a test clean-up, we reconfigure the original password that the system booted with to allow regression to continue running.

Please read the documentation specified in the head of the test to know more about limitations and prerequisites using this test and plan carefully where to run this test. It is recommended to run it at end of your regression run.

Important Note

we validate the case for the given image in the parameter --restore_to_image not the current installed image!

Requirements to run the test

  1. Having a stable system with sonic image installed, the system is configured with user:'admin' and password:'YourPaSsWoRd', if you have different password for 'admin' you need to change it in the class DefaultConsts in DEFAULT_PASSWORD const.
  2. A path to an existing image, it is your responsibility to provide an existing valid image, otherwise the test will fail. the test expects path to a binary file in the format: /../../../../<an_image_of_your_choice>.bin, and the image is accessed with no password, don't put path to an image in different server that is accessible through password because it will fail
  3. ONIE should be accessed with user: 'root' through ssh connection or with no password or the password: 'root'
  4. the default password for the new image should be as DEFAULT_PASSWORD const!

Type of change

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

Approach

What is the motivation for this PR?

Validating default password change after initial boot for default user such as admin.

How did you do it?

  1. taking a path to an image
  2. manufacturing the switch to this image by uploading bin to ONIE and install it from ONIE
  3. using Pexpect python module to communicate with the switch and validate expiring password message to appear after the first login.
  4. suggesting a new password and then reconnecting to switch and validating that there is no expiring message to reappear
  5. As part of clean-up we enforce the original password.

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

any topology is supported.

Documentation

this test case is relevant for this HLD: sonic-net/SONiC#1077

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@lgtm-com
Copy link

lgtm-com bot commented Nov 21, 2022

This pull request introduces 1 alert when merging e361b27 into b2b45b7 - view on LGTM.com

new alerts:

  • 1 for Clear-text logging of sensitive information

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/default_consts.py:25:19: E127 continuation line over-indented for visual indent
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
...
[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>

@lgtm-com
Copy link

lgtm-com bot commented Nov 21, 2022

This pull request introduces 1 alert when merging c201990 into b2b45b7 - view on LGTM.com

new alerts:

  • 1 for Clear-text logging of sensitive information

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/default_consts.py:5:1: E302 expected 2 blank lines, found 0
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F403 'from ansible.module_utils.basic import ' used; unable to detect undefined names
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:21:1: F401 'ansible.module_utils.basic.
' imported but unused
tests/platform_tests/test_first_time_boot_password_change/manufacture.py:139:25: E127 continuation line over-indented for visual indent
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

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_first_time_boot_password_change/test_first_time_boot_password_change.py:31:62: E261 at least two spaces before inline comment

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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py

check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed

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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/default_consts.py
Fixing tests/platform_tests/test_first_time_boot_password_change/manufacture.py
Fixing tests/platform_tests/test_first_time_boot_password_change/onie_install.sh
Fixing tests/platform_tests/test_first_time_boot_password_change/test_first_time_boot_password_change.py

check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed

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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/platform_tests/test_first_time_boot_password_change/onie_install.sh
Fixing tests/platform_tests/test_first_time_boot_password_change/test_first_time_boot_password_change.py

check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

tests/platform_tests/test_first_time_boot_password_change/default_consts.py: failed parsing with CPython 3.8.10:

Traceback (most recent call last):
File "/home/vsts/.cache/pre-commit/repol_qnbgwt/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
ast.parse(f.read(), filename=filename)
...
[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>

@azure-pipelines
Copy link

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.........................................................Failed
- hook id: check-ast
- exit code: 1

tests/platform_tests/test_first_time_boot_password_change/default_consts.py: failed parsing with CPython 3.8.10:

Traceback (most recent call last):
File "/home/vsts/.cache/pre-commit/repolekuzpn7/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
ast.parse(f.read(), filename=filename)
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "tests/platform_tests/test_first_time_boot_password_change/default_consts.py", line 49
<<<<<<< a425986
^
SyntaxError: invalid syntax

...
[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>

@liuh-80
Copy link
Contributor

liuh-80 commented Dec 9, 2022

Copy my comments from sonic-net/sonic-buildimage#12678 :

I create following PR to validate this change:
sonic-net/sonic-buildimage#12983

As you can see, after enable this feature, every UT failed in 'prepare testbed' stage:
https://dev.azure.com/mssonic/build/_build/results?buildId=185495&view=logs&j=a35c5435-5100-57cf-f655-60b256043d84&t=c9f737d3-1e43-5e60-26d7-f79fbfea8dbb

I'm didn't check detail of why that step failed, but I think that step failed because current code trying to login but not reset password.

I suggest fix UT break issue in sonic-mgmt before this PR merge. the fix can reuse the logic in check_install.py.

Current UT PR only add new UT to cover this feature, but existed UTs will break when this feature enabled.

@azmyali98
Copy link
Contributor Author

@liuh-80 , Hi, this test is meant to be standalone, I am adding the support for regression in another PR (the stage of connecting to the engine and handling the password expire)

@liuh-80
Copy link
Contributor

liuh-80 commented Dec 13, 2022

@liuh-80 , Hi, this test is meant to be standalone, I am adding the support for regression in another PR (the stage of connecting to the engine and handling the password expire)

Thanks, please also add that PR to the PR table in HLD PR description:
sonic-net/SONiC#1077

@azmyali98
Copy link
Contributor Author

@liuh-80, I added an option "feature_enabled" that will be set to False as default and once set to True it will run the test otherwise it will skip the tests :)

@liat-grozovik
Copy link
Collaborator

@azmyali98 can you please also go over the pre check failures and try to solve even if not part of your code changes?

@azmyali98
Copy link
Contributor Author

@liat-grozovik it is fixed

@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-mgmt

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@azmyali98 please review failures and if not related to the new test please retrigger until we can merge it.
also, please ensure to add it to the HLD PR description for tracking the feature quality. ask the feature owner/deliver to ensure it

@liat-grozovik
Copy link
Collaborator

@wangxin @azmyali98 can you please confirm all comments were addressed and we are good to merge this test?
code prs are already in master we can/should add it to the nightly regression

@wangxin wangxin merged commit 359d84b into sonic-net:master Mar 17, 2023
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

Successfully merging this pull request may close these issues.

5 participants