diff --git a/.azure-pipelines/run-test-elastictest-template.yml b/.azure-pipelines/run-test-elastictest-template.yml index afe86994db4..00d9a474ad6 100644 --- a/.azure-pipelines/run-test-elastictest-template.yml +++ b/.azure-pipelines/run-test-elastictest-template.yml @@ -122,10 +122,18 @@ parameters: type: string default: "" + # Enable parallel run for test cases that support parallel run - name: ENABLE_PARALLEL_RUN type: string default: "" + # Specify the file that contains the parallel mode for test cases that need to run in parallel when + # ENABLE_PARALLEL_RUN is set to True. Default value is the test_parallel_modes/default.json file in this repo. + # This field will be ignored if ENABLE_PARALLEL_RUN is set to False. + - name: PARALLEL_MODES_FILE + type: string + default: "" + # The number of retries when the script fails. Global retry if retry_cases_include and retry_cases_exclude are both empty, otherwise specific retry - name: RETRY_TIMES type: string @@ -264,6 +272,8 @@ steps: --repo-name ${{ parameters.REPO_NAME }} \ --mgmt-branch ${{ parameters.MGMT_BRANCH }} \ --stop-on-failure ${{ parameters.STOP_ON_FAILURE }} \ + --enable-parallel-run ${{ parameters.ENABLE_PARALLEL_RUN }} \ + --parallel-modes-file ${{ parameters.PARALLEL_MODES_FILE }} \ --retry-times ${{ parameters.RETRY_TIMES }} \ --requester "${{ parameters.REQUESTER }}" \ --max-execute-seconds $((${{ parameters.MAX_RUN_TEST_MINUTES }} * 60)) \ diff --git a/.azure-pipelines/test_plan.py b/.azure-pipelines/test_plan.py index 93eb42efcb1..84e0cd33efd 100644 --- a/.azure-pipelines/test_plan.py +++ b/.azure-pipelines/test_plan.py @@ -307,6 +307,7 @@ def create(self, topology, test_plan_name="my_test_plan", deploy_mg_extra_params "test_option": { "stop_on_failure": kwargs.get("stop_on_failure", True), "enable_parallel_run": kwargs.get("enable_parallel_run", False), + "parallel_modes_file": kwargs.get("parallel_modes_file", "default.json"), "retry_times": kwargs.get("retry_times", 2), "retry_cases_include": retry_cases_include, "retry_cases_exclude": retry_cases_exclude, @@ -831,6 +832,16 @@ def poll(self, test_plan_id, interval=60, timeout=-1, expected_state="", expecte choices=[True, False], help="Enable parallel run or not." ) + parser_create.add_argument( + "--parallel-modes-file", + type=str, + dest="parallel_modes_file", + nargs='?', + const='default.json', + default='default.json', + required=False, + help="Which parallel modes file to use when parallel run is enabled." + ) parser_create.add_argument( "--retry-times", type=int, @@ -1034,6 +1045,7 @@ def poll(self, test_plan_id, interval=60, timeout=-1, expected_state="", expecte platform=args.platform, stop_on_failure=args.stop_on_failure, enable_parallel_run=args.enable_parallel_run, + parallel_modes_file=args.parallel_modes_file, retry_times=args.retry_times, retry_cases_include=args.retry_cases_include, retry_cases_exclude=args.retry_cases_exclude, diff --git a/tests/test_parallel_modes/cisco_t2_8800.json b/tests/test_parallel_modes/cisco_t2_8800.json new file mode 100644 index 00000000000..6d443f8c631 --- /dev/null +++ b/tests/test_parallel_modes/cisco_t2_8800.json @@ -0,0 +1,31 @@ +{ + "arp/test_neighbor_mac_noptf.py": "FULL_PARALLEL", + "autorestart/test_container_autorestart.py": "RP_FIRST", + "bgp/test_bgp_fact.py": "FULL_PARALLEL", + "bgp/test_bgp_session_flap.py": "FULL_PARALLEL", + "container_checker/test_container_checker.py": "RP_FIRST", + "crm/test_crm.py": "FULL_PARALLEL", + "iface_namingmode/test_iface_namingmode.py": "FULL_PARALLEL", + "lldp/test_lldp.py": "FULL_PARALLEL", + "memory_checker/test_memory_checker.py": "FULL_PARALLEL", + "override_config_table/test_override_config_table_masic.py": "FULL_PARALLEL", + "passw_hardening/test_passw_hardening.py": "FULL_PARALLEL", + "pc/test_po_cleanup.py": "FULL_PARALLEL", + "platform_tests/api/test_chassis.py": "FULL_PARALLEL", + "platform_tests/api/test_module.py": "FULL_PARALLEL", + "platform_tests/api/test_sfp.py": "FULL_PARALLEL", + "platform_tests/api/test_thermal.py": "FULL_PARALLEL", + "platform_tests/cli/test_show_chassis_module.py": "FULL_PARALLEL", + "platform_tests/link_flap/test_cont_link_flap.py": "FULL_PARALLEL", + "platform_tests/sfp/test_sfputil.py": "FULL_PARALLEL", + "platform_tests/test_memory_exhaustion.py": "RP_FIRST", + "platform_tests/test_reboot.py": "RP_FIRST", + "platform_tests/test_reload_config.py": "RP_FIRST", + "platform_tests/test_sequential_restart.py": "FULL_PARALLEL", + "show_techsupport/test_techsupport.py": "FULL_PARALLEL", + "show_techsupport/test_techsupport_no_secret.py": "FULL_PARALLEL", + "snmp/test_snmp_cpu.py": "FULL_PARALLEL", + "snmp/test_snmp_interfaces.py": "FULL_PARALLEL", + "snmp/test_snmp_link_local.py": "FULL_PARALLEL", + "snmp/test_snmp_queue.py": "RP_FIRST" +} diff --git a/tests/test_parallel_modes/default.json b/tests/test_parallel_modes/default.json new file mode 100644 index 00000000000..e82a6fb6a77 --- /dev/null +++ b/tests/test_parallel_modes/default.json @@ -0,0 +1,5 @@ +{ + "bgp/test_bgp_fact.py": "FULL_PARALLEL", + "lldp/test_lldp.py": "FULL_PARALLEL", + "snmp/test_snmp_interfaces.py": "FULL_PARALLEL" +}