Skip to content

Commit

Permalink
Roll out the left PR checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
yutongzhang-microsoft committed Jan 17, 2025
1 parent 0440654 commit 0b6d1aa
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/impacted_area_testing/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - t0-2vlans
# - t0-sonic
# - t1- lag
PR_TOPOLOGY_TYPE = ["t0", "t0-2vlans", "t0-sonic", "t1", "t1-multi-asic", "dpu", "dualtor"]
PR_TOPOLOGY_TYPE = ["t0_checker", "t0-2vlans", "t0-sonic", "t1_checker", "t1-multi-asic", "dpu", "dualtor"]

EXCLUDE_TEST_SCRIPTS = [
"test_posttest.py",
Expand Down
21 changes: 13 additions & 8 deletions .azure-pipelines/impacted_area_testing/get_test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ def topo_name_to_type(topo_name):
return topo_name

topo_type = match.group()

if topo_type in ['mgmttor', 'm0', 'mc0', 'mx', 't0-52', 't0-mclag']:
# certain testbed types are in 't0' category with different names.
topo_type = 't0'
if topo_type in ['t1-lag', 't1-56-lag', 't1-64-lag']:
elif topo_type in ['t1-lag', 't1-56-lag', 't1-64-lag']:
topo_type = 't1'

return topo_type


def distribute_scripts_to_PR_checkers(match, script_name, test_scripts_per_topology_type):
for topology in match.group(1).split(","):
topology_mark = topology.strip().strip('"').strip("'")
if topology_mark == "any":
for key in ["t0", "t1"]:
for key in ["t0_checker", "t1_checker"]:
if script_name not in test_scripts_per_topology_type[key]:
test_scripts_per_topology_type[key].append(script_name)
else:
Expand All @@ -65,11 +67,6 @@ def collect_scripts_by_topology_type(features: str, location: str) -> dict:
# Note: The full path and name of files are stored in a list named "files"
scripts = []

# This is just for the first stage of rolling out
# To avoid the overuse of resource, we will ignore the PR which modifies the common part.
if features == "":
return {}

for feature in features.split(","):
feature_path = os.path.join(location, feature)
for root, dirs, script in os.walk(feature_path):
Expand Down Expand Up @@ -103,7 +100,15 @@ def collect_scripts_by_topology_type(features: str, location: str) -> dict:
except Exception as e:
raise Exception('Exception occurred while trying to get topology in {}, error {}'.format(s, e))

return {k: v for k, v in test_scripts_per_topology_type.items() if v}
test_scripts = {k: v for k, v in test_scripts_per_topology_type.items() if v}

# This is just for the first stage of rolling out
# To avoid the overuse of resource, we will ignore the PR which modifies the common part.
if features == "":
test_scripts.pop("t0_checker")
test_scripts.pop("t1_checker")

return test_scripts


def main(features, location):
Expand Down
186 changes: 159 additions & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ stages:
value: $(Build.SourceBranchName)

jobs:
# Below are Impacted Area Based PR checkers
- job: get_impacted_area
displayName: "Get impacted area"
timeoutInMinutes: 240
Expand All @@ -85,7 +86,7 @@ stages:
- job: impacted_area_t0_elastictest
displayName: "impacted-area-kvmtest-t0 by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0')
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
Expand All @@ -104,9 +105,165 @@ stages:
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_t0_2vlans_elastictest
displayName: "impacted-area-kvmtest-t0_2vlans by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-2vlans')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-2vlans
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_t1_lag_elastictest
displayName: "impacted-area-kvmtest-t1-lag by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_dualtor_elastictest
displayName: "impacted-area-kvmtest-dualtor by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dualtor')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dualtor
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dualtor
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_multi_asic_elastictest
displayName: "impacted-area-kvmtest-multi_asic by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1-multi-asic')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1-multi-asic
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-8-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
NUM_ASIC: 4
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_sonic_t0_elastictest
displayName: "impacted-area-kvmtest-sonic_t0 by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-sonic')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-sonic
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0-64-32
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
COMMON_EXTRA_PARAMS: "--neighbor_type=sonic "
VM_TYPE: vsonic
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_dpu_elastictest
displayName: "impacted-area-kvmtest-dpu by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dpu')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dpu
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dpu
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

# Below is the original PR checkers
- job: t0_elastictest
displayName: "kvmtest-t0 by Elastictest"
timeoutInMinutes: 240
Expand Down Expand Up @@ -151,31 +308,6 @@ stages:
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"

- job: impacted_area_t1_lag_elastictest
displayName: "impacted-area-kvmtest-t1-lag by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: $(BUILD_BRANCH)
STOP_ON_FAILURE: "False"

- job: dualtor_elastictest
displayName: "kvmtest-dualtor-t0 by Elastictest"
timeoutInMinutes: 240
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,18 @@ platform_tests/test_advanced_reboot.py::test_warm_reboot:
conditions:
- "asic_type in ['vs'] and 't0' not in topo_name"

platform_tests/test_advanced_reboot.py::test_warm_reboot_mac_jump:
skip:
reason: "Skip in PR testing as taking too much time."
conditions:
- "asic_type in ['vs']"

platform_tests/test_advanced_reboot.py::test_warm_reboot_sad:
skip:
reason: "Skip in PR testing as taking too much time."
conditions:
- "asic_type in ['vs']"

#######################################
##### test_cont_warm_reboot.py #####
#######################################
Expand Down

0 comments on commit 0b6d1aa

Please sign in to comment.