diff --git a/ansible/roles/test/tasks/continuous_reboot.yml b/ansible/roles/test/tasks/continuous_reboot.yml new file mode 100644 index 00000000000..3511187f8b0 --- /dev/null +++ b/ansible/roles/test/tasks/continuous_reboot.yml @@ -0,0 +1,14 @@ +########################################################################## +# Repeat reboot test case times # +########################################################################## + +- name: set default value for repeat_count + set_fact: + repeat_count: 3 + when: repeat_count is not defined + +- debug: + msg: "Execute reboot.yml {{ repeat_count }} time(s)" + +- include: reboot.yml + with_sequence: end={{repeat_count}} diff --git a/ansible/roles/test/tasks/repeat_harness.yml b/ansible/roles/test/tasks/repeat_harness.yml index 5c0554e83b9..4d140f92c1a 100644 --- a/ansible/roles/test/tasks/repeat_harness.yml +++ b/ansible/roles/test/tasks/repeat_harness.yml @@ -1,16 +1,13 @@ ########################################################################## -# Repeat harness is used to repeat a list of tasks, for single test case # -# repeatation, we can use repeat_count in test by testcase name # -# infrastructure. This test case is the template for repeat a list # -# of test cases, or run a test with delay between iterations. etc. # +# Repeat harness is used to repeat a list of tasks, the list of the # +# tasks should be defined in repeat_tasks.yml # ########################################################################## -- debug: - msg: "===================== Repeating starts ======================" +- name: Default test repeat count + set_fact: repeat_count=3 + when: repeat_count is not defined -# Add tasks here to be repeated: -# e.g. - include: reboot.yml +- debug: msg="Execute repeat_tasks.yml {{ repeat_count }} time(s)" - -- debug: - msg: "===================== Repeating ends ======================" +- include: repeat_tasks.yml + with_sequence: end={{repeat_count}} diff --git a/ansible/roles/test/tasks/repeat_tasks.yml b/ansible/roles/test/tasks/repeat_tasks.yml new file mode 100644 index 00000000000..0c9ee862741 --- /dev/null +++ b/ansible/roles/test/tasks/repeat_tasks.yml @@ -0,0 +1,13 @@ +########################################################################## +# Repeat task is used to specify a list of tasks to repeat. # +########################################################################## + +- debug: + msg: "===================== Repeating starts ======================" + +# Add tasks here to be repeated: +# e.g. - include: reboot.yml + + +- debug: + msg: "===================== Repeating ends ======================" diff --git a/ansible/roles/test/tasks/test_sonic_by_testname.yml b/ansible/roles/test/tasks/test_sonic_by_testname.yml index 3c4cba9ad78..402a66ddf4e 100644 --- a/ansible/roles/test/tasks/test_sonic_by_testname.yml +++ b/ansible/roles/test/tasks/test_sonic_by_testname.yml @@ -27,17 +27,11 @@ - sonic_hwsku in mellanox_hwskus - dscp_mode is not defined - - name: Set test repeat count - set_fact: - repeat_count: 1 - when: repeat_count is not defined - - debug: var=testcases[testcase_name]['execvars'] when: testcases[testcase_name]['execvars'] is defined -- name: run test case {{ testcases[testcase_name]['filename'] }} file {{ repeat_count }} time(s) +- name: run test case {{ testcases[testcase_name]['filename'] }} file include: "{{ testcases[testcase_name]['filename'] }}" - with_sequence: end={{ repeat_count }} - debug: msg="!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - debug: msg="!!!!!!!!!!!!!!!!!!!! end running test {{ testcase_name }} !!!!!!!!!!!!!!!!!!!!" diff --git a/ansible/roles/test/vars/testcases.yml b/ansible/roles/test/vars/testcases.yml index 230efd1d628..b8ef2502b86 100644 --- a/ansible/roles/test/vars/testcases.yml +++ b/ansible/roles/test/vars/testcases.yml @@ -1,8 +1,4 @@ testcases: - repeat_harness: - filename: repeat_harness.yml - topologies: [t0, t0-64, t0-64-32,t0-116, t1, t1-lag, t1-64-lag, ptf32, ptf64] - acl: filename: acl.yml topologies: [t1, t1-lag, t1-64-lag] @@ -35,6 +31,10 @@ testcases: ptf_host: testbed_type: + continuous_reboot: + filename: continuous_reboot.yml + topologies: [t0, t0-64, t0-64-32, t0-116, t1, t1-lag, t1-64-lag] + copp: filename: copp.yml topologies: [ptf32, ptf64] @@ -126,6 +126,10 @@ testcases: filename: reboot.yml topologies: [t0, t0-64, t0-64-32, t0-116, t1, t1-lag, t1-64-lag, ptf32, ptf64] + repeat_harness: + filename: repeat_harness.yml + topologies: [t0, t0-64, t0-64-32, t0-116, t1, t1-lag, t1-64-lag, ptf32, ptf64] + restart_swss: filename: run_config_cleanup.yml topologies: [t0, t0-64, t0-64-32, t0-116, t1, t1-lag, t1-64-lag, ptf32, ptf64]