Skip to content

High Level Design of Impacted Area based PR testing.#14761

Merged
wangxin merged 5 commits intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/HLD_simplified_PR_test
Jan 10, 2025
Merged

High Level Design of Impacted Area based PR testing.#14761
wangxin merged 5 commits intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/HLD_simplified_PR_test

Conversation

@yutongzhang-microsoft
Copy link
Copy Markdown
Contributor

@yutongzhang-microsoft yutongzhang-microsoft commented Sep 26, 2024

Description of PR

We propose a model of PR testing called "Impacted Area based PR testing", which determined the scope of PR testing based on the inpacted area. It reduces both time and cost efficiently. This PR is the high level design of this new model of PR testing.

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

We propose a model of PR testing called "Impacted Area based PR testing", which determined the scope of PR testing based on the inpacted area. It reduces both time and cost efficiently. This PR is the high level design of this new model of PR testing.

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

We will maintain a set of test scripts for each topology,
allowing us to select relevant scripts based on the corresponding topology set within the change scope.
This method eliminates unnecessary processes by executing only the on-demand scripts,
resulting in reduced running time.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please elaborate the 2nd recommended approach.

### To schedule instances automatically
We will dynamically allocate instances based on the number of scripts each PR checker executes.
By analyzing the running time of each script from previous runs,
we will allocate instances proportional to the total execution time for each PR checker.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please elaborate more about how to decide how many instances to use.

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

Fixing .azure-pipelines/simplified_PR_test/README.md

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

@yutongzhang-microsoft yutongzhang-microsoft force-pushed the yutongzhang/HLD_simplified_PR_test branch from 6c29fc2 to 2854b2f Compare October 15, 2024 06:11
@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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing .azure-pipelines/simplified_PR_test/README.md

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

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

Fixing .azure-pipelines/simplified_PR_test/README.md

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

including the running time, date, results, and more.
To determine the preset running time for each test script,
we will calculate the average running time of the latest five run times.
If no relevant records are found in Kusto, a default value(1800s per script) will be used for the preset running time.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1800s per script, 1800s is 30 minutes, how to determine this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This time is to keep pace with Elastictest.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, lets' use it first.

To achieve our goal, we carried out some preparatory work by eliminating these cross-feature dependencies.


## Design
Copy link
Copy Markdown
Contributor

@lerry-lee lerry-lee Dec 10, 2024

Choose a reason for hiding this comment

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

Could you add a chart to clarify the workflow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which workflow? Here, we just manually remove the cross-feature dependencies.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The design flowchart, step by step

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think each step is listed as a subtitle in the part "Design". Here, we can not see the process dynamically, so I don't think it's necessary to add the flowchart.

@yutongzhang-microsoft yutongzhang-microsoft changed the title High Level Design of new simplified PR test. High Level Design of Impacted Area based PR testing. Dec 11, 2024
wangxin pushed a commit that referenced this pull request Dec 31, 2024
What is the motivation for this PR?
We introduce a new model of PR testing called "Impacted Area-Based PR Testing," designed to be time-efficient, cost-efficient, and highly flexible. The HLD is detailed in #14761, and this PR represents its implementation

How did you do it?
We redefine the scope of PR testing by impacted area, which means we will only run the test scripts really affected by the changes.

How did you verify/test it?
Test by pipeline.
@wangxin wangxin merged commit b24a282 into sonic-net:master Jan 10, 2025
@yutongzhang-microsoft yutongzhang-microsoft deleted the yutongzhang/HLD_simplified_PR_test branch January 10, 2025 06:36
wangxin pushed a commit that referenced this pull request Jan 14, 2025
What is the motivation for this PR?
In PR #14761, we introduced the HLD for Impacted Area-Based PR testing. However, the document was placed in an outdated path. In this PR, we relocate it to the correct path.

How did you do it?
In this PR, we relocate the HLD to the correct path.
nnelluri-cisco pushed a commit to nnelluri-cisco/sonic-mgmt that referenced this pull request Mar 15, 2025
What is the motivation for this PR?
We introduce a new model of PR testing called "Impacted Area-Based PR Testing," designed to be time-efficient, cost-efficient, and highly flexible. The HLD is detailed in sonic-net#14761, and this PR represents its implementation

How did you do it?
We redefine the scope of PR testing by impacted area, which means we will only run the test scripts really affected by the changes.

How did you verify/test it?
Test by pipeline.
nnelluri-cisco pushed a commit to nnelluri-cisco/sonic-mgmt that referenced this pull request Mar 15, 2025
We propose a model of PR testing called "Impacted Area based PR testing", which determined the scope of PR testing based on the impacted area. It reduces both time and cost efficiently. This PR is the high level design of this new model of PR testing.
nnelluri-cisco pushed a commit to nnelluri-cisco/sonic-mgmt that referenced this pull request Mar 15, 2025
What is the motivation for this PR?
In PR sonic-net#14761, we introduced the HLD for Impacted Area-Based PR testing. However, the document was placed in an outdated path. In this PR, we relocate it to the correct path.

How did you do it?
In this PR, we relocate the HLD to the correct path.
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.

4 participants