diff --git a/ansible/roles/test/tasks/repeat_harness.yml b/ansible/roles/test/tasks/repeat_harness.yml new file mode 100644 index 00000000000..3758f9cae14 --- /dev/null +++ b/ansible/roles/test/tasks/repeat_harness.yml @@ -0,0 +1,18 @@ +#------------------------------------------------------------------- +# Repeat harness: Repeat a list of taks defined in repeat_tasks.yml, +# by default, 10 times. +# repeat count can be set by +# --extra-vars 'test_iterations=' +#------------------------------------------------------------------- + +- name: Default test count + set_fact: + test_count=10 + +- name: Update test count + set_fact: + test_count={{test_iterations}} + when: test_iterations is defined + +- include: repeat_tasks.yml iteration={{item}} + with_sequence: start=1 end={{test_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..12fcecbad94 --- /dev/null +++ b/ansible/roles/test/tasks/repeat_tasks.yml @@ -0,0 +1,9 @@ +- debug: + msg: "Repeat harness: iteration {{ iteration }} starts" + +# Add tasks here to be repeated: +# e.g. - include: reboot.yml + +- debug: + msg: "Repeat harness: iteration {{ iteration }} ends" + diff --git a/ansible/roles/test/tasks/test_sonic_by_tag.yml b/ansible/roles/test/tasks/test_sonic_by_tag.yml index 56cf17b7536..1e7e006fded 100644 --- a/ansible/roles/test/tasks/test_sonic_by_tag.yml +++ b/ansible/roles/test/tasks/test_sonic_by_tag.yml @@ -106,6 +106,10 @@ include: reboot.yml tags: reboot +- name: Test case repeat harness + include: repeat_harness.yml + tags: repeat_harness + ### When calling the following tests, please add command line of what testbed_type and which PTF docker to test against ### -e "testbed_type=t1-lag ptf_host=10.0.0.200" - name: Fib test diff --git a/ansible/roles/test/vars/testcases.yml b/ansible/roles/test/vars/testcases.yml index cb9ffe32c0a..cfc2c3295b4 100644 --- a/ansible/roles/test/vars/testcases.yml +++ b/ansible/roles/test/vars/testcases.yml @@ -1,4 +1,8 @@ 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]