summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_rollback
diff options
context:
space:
mode:
authorDavid Newswanger <gamma.dave@gmail.com>2017-08-17 04:35:33 -0400
committerTrishna Guha <trishnaguha17@gmail.com>2017-08-17 14:05:33 +0530
commitc810a62db966a5396d1ec9e762334cb9bf22751b (patch)
tree15d8cc50c4f330a6bcf85b7fe69df2db929c91ef /test/integration/targets/nxos_rollback
parentf2c34d51f2442e71a1b515068c242e98e10a7a65 (diff)
downloadansible-c810a62db966a5396d1ec9e762334cb9bf22751b.tar.gz
nxos: merge nxapi/cli tests - ospf, portchannel, rollback, switchport (#28240)
* refactor nxos_ospf * refactor nxos_portchannel * refactor nxos_rollback * refactor nxos_switchport
Diffstat (limited to 'test/integration/targets/nxos_rollback')
-rw-r--r--test/integration/targets/nxos_rollback/tasks/cli.yaml16
-rw-r--r--test/integration/targets/nxos_rollback/tasks/nxapi.yaml16
-rw-r--r--test/integration/targets/nxos_rollback/tests/common/sanity.yaml (renamed from test/integration/targets/nxos_rollback/tests/cli/sanity.yaml)10
-rw-r--r--test/integration/targets/nxos_rollback/tests/nxapi/sanity.yaml29
4 files changed, 31 insertions, 40 deletions
diff --git a/test/integration/targets/nxos_rollback/tasks/cli.yaml b/test/integration/targets/nxos_rollback/tasks/cli.yaml
index d675462dd0..0ab3f8f908 100644
--- a/test/integration/targets/nxos_rollback/tasks/cli.yaml
+++ b/test/integration/targets/nxos_rollback/tasks/cli.yaml
@@ -1,15 +1,25 @@
---
-- name: collect all cli test cases
+- name: collect common cli test cases
find:
- paths: "{{ role_path }}/tests/cli"
+ paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
+- name: collect cli test cases
+ find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
+ register: cli_cases
+
+- set_fact:
+ test_cases:
+ files: "{{ test_cases.files }} + {{ cli_cases.files }}"
+
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
- include: "{{ test_case_to_run }}"
+ include: "{{ test_case_to_run }} connection={{ cli }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
diff --git a/test/integration/targets/nxos_rollback/tasks/nxapi.yaml b/test/integration/targets/nxos_rollback/tasks/nxapi.yaml
index ea525379f7..e071f293a2 100644
--- a/test/integration/targets/nxos_rollback/tasks/nxapi.yaml
+++ b/test/integration/targets/nxos_rollback/tasks/nxapi.yaml
@@ -1,10 +1,20 @@
---
-- name: collect all nxapi test cases
+- name: collect common nxapi test cases
find:
- paths: "{{ role_path }}/tests/nxapi"
+ paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
+- name: collect nxapi test cases
+ find:
+ paths: "{{ role_path }}/tests/nxapi"
+ patterns: "{{ testcase }}.yaml"
+ register: nxapi_cases
+
+- set_fact:
+ test_cases:
+ files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
+
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@@ -16,7 +26,7 @@
provider: "{{ cli }}"
- name: run test case
- include: "{{ test_case_to_run }}"
+ include: "{{ test_case_to_run }} connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
diff --git a/test/integration/targets/nxos_rollback/tests/cli/sanity.yaml b/test/integration/targets/nxos_rollback/tests/common/sanity.yaml
index a03a52631e..7922669643 100644
--- a/test/integration/targets/nxos_rollback/tests/cli/sanity.yaml
+++ b/test/integration/targets/nxos_rollback/tests/common/sanity.yaml
@@ -1,5 +1,5 @@
---
-- debug: msg="START TRANSPORT:CLI nxos_rollback sanity test"
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_rollback sanity test"
- name: delete existing checkpoint file
nxos_config: &delete
@@ -7,23 +7,23 @@
- terminal dont-ask
- delete backup.cfg
match: none
- provider: "{{ cli }}"
+ provider: "{{ connection }}"
ignore_errors: yes
- name: Create checkpoint file
nxos_rollback:
checkpoint_file: backup.cfg
timeout: 300
- provider: "{{ cli }}"
+ provider: "{{ connection }}"
- name: rollback to the previously created checkpoint file
nxos_rollback:
rollback_to: backup.cfg
timeout: 300
- provider: "{{ cli }}"
+ provider: "{{ connection }}"
- name: cleanup checkpoint file
nxos_config: *delete
ignore_errors: yes
-- debug: msg="END TRANSPORT:CLI nxos_rollback sanity test"
+- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_rollback sanity test"
diff --git a/test/integration/targets/nxos_rollback/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_rollback/tests/nxapi/sanity.yaml
deleted file mode 100644
index 248568a964..0000000000
--- a/test/integration/targets/nxos_rollback/tests/nxapi/sanity.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-- debug: msg="START TRANSPORT:NXAPI nxos_rollback sanity test"
-
-- name: delete existing checkpoint file
- nxos_config: &delete
- commands:
- - terminal dont-ask
- - delete backup.cfg
- match: none
- provider: "{{ nxapi }}"
- ignore_errors: yes
-
-- name: Create checkpoint file
- nxos_rollback:
- checkpoint_file: backup.cfg
- timeout: 300
- provider: "{{ nxapi }}"
-
-- name: rollback to the previously created checkpoint file
- nxos_rollback:
- rollback_to: backup.cfg
- timeout: 300
- provider: "{{ nxapi }}"
-
-- name: cleanup checkpoint file
- nxos_config: *delete
- ignore_errors: yes
-
-- debug: msg="END TRANSPORT:NXAPI nxos_rollback sanity test"