Skip to content

Commit

Permalink
Define whether a test is required by code (#11921)
Browse files Browse the repository at this point in the history
* Define whether a test is required by code

Why I did it
Define whether a test job is required before merging by code.
Let the failure of multi-asic and t0-sonic don't block pr merge.
The 'required' configuration can be modified by the owner in the future.

How I did it
Required:
t1-lag, t0
Not required:
multi-asic, t0-sonic

How to verify it
AZP itself verifies it.

Signed-off-by: jianquanye@microsoft.com
  • Loading branch information
yejianquan authored Sep 2, 2022
1 parent a684392 commit 750e1b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .azure-pipelines/run-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ steps:
rm -rf $(Build.ArtifactStagingDirectory)/*
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }} ${{ parameters.section }}"
displayName: "Run tests"
${{ if eq(parameters.tbtype, 'multi-asic-t1-lag-pr') }}:
continueOnError: true

- script: |
# save dut state if test fails
virsh_version=$(virsh --version)
Expand Down
15 changes: 10 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ stages:
- name: testbed_file
value: vtestbed.csv

# For every test job:
# continueOnError: false means it's a required test job and will block merge if it fails
# continueOnError: true means it's an optional test job and will not block merge even though it fails(unless a required test job depends on its result)

jobs:
- job:
pool: sonictest
Expand Down Expand Up @@ -133,7 +137,7 @@ stages:
pool: sonictest
displayName: "kvmtest-t0-part1"
timeoutInMinutes: 360

continueOnError: true
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
Expand All @@ -147,7 +151,7 @@ stages:
pool: sonictest
displayName: "kvmtest-t0-part2"
timeoutInMinutes: 360

continueOnError: true
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
Expand All @@ -165,6 +169,7 @@ stages:
- t0_part1
- t0_part2
condition: always()
continueOnError: false
variables:
resultOfPart1: $[ dependencies.t0_part1.result ]
resultOfPart2: $[ dependencies.t0_part2.result ]
Expand All @@ -183,7 +188,7 @@ stages:
pool: sonictest-t1-lag
displayName: "kvmtest-t1-lag"
timeoutInMinutes: 360

continueOnError: false
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
Expand All @@ -196,7 +201,7 @@ stages:
pool: sonictest-sonic-t0
displayName: "kvmtest-t0-sonic"
timeoutInMinutes: 360

continueOnError: true
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
Expand All @@ -210,7 +215,7 @@ stages:
pool: sonictest-ma
displayName: "kvmtest-multi-asic-t1-lag"
timeoutInMinutes: 240

continueOnError: true
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
Expand Down

0 comments on commit 750e1b3

Please sign in to comment.