Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic test] introduce a repeat harness #402

Merged
merged 4 commits into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ansible/roles/test/tasks/repeat_harness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
##########################################################################
# 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. #
##########################################################################

- debug:
msg: "===================== Repeating starts ======================"

# Add tasks here to be repeated:
# e.g. - include: reboot.yml


- debug:
msg: "===================== Repeating ends ======================"
8 changes: 7 additions & 1 deletion ansible/roles/test/tasks/test_sonic_by_testname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
- 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
- name: run test case {{ testcases[testcase_name]['filename'] }} file {{ repeat_count }} time(s)
include: "{{ testcases[testcase_name]['filename'] }}"
with_sequence: end={{ repeat_count }}

- debug: msg="!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- debug: msg="!!!!!!!!!!!!!!!!!!!! end running test {{ testcase_name }} !!!!!!!!!!!!!!!!!!!!"
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/test/vars/testcases.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down