Skip to content

Commit

Permalink
[repeat harness] rework repeat harness and introduce test case contin…
Browse files Browse the repository at this point in the history
…uous reboot (#416)

* [Repeat harness] rework repeat harness to make it an individual test case

Adding with_sequence to test by name infrastructure breaks link_flap test due to
nested loop at different level of includes.

Move repeat harness to alphabetic location

* [continuous reboot] introduce test case continuous reboot
  • Loading branch information
yxieca authored Jan 5, 2018
1 parent af55175 commit 865244d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
14 changes: 14 additions & 0 deletions ansible/roles/test/tasks/continuous_reboot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##########################################################################
# Repeat reboot test case <repeat_count> 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}}
19 changes: 8 additions & 11 deletions ansible/roles/test/tasks/repeat_harness.yml
Original file line number Diff line number Diff line change
@@ -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}}
13 changes: 13 additions & 0 deletions ansible/roles/test/tasks/repeat_tasks.yml
Original file line number Diff line number Diff line change
@@ -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 ======================"
8 changes: 1 addition & 7 deletions ansible/roles/test/tasks/test_sonic_by_testname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} !!!!!!!!!!!!!!!!!!!!"
Expand Down
12 changes: 8 additions & 4 deletions ansible/roles/test/vars/testcases.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 865244d

Please sign in to comment.