Skip to content

Commit

Permalink
Redirection tests should not run with 2.9
Browse files Browse the repository at this point in the history
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
  • Loading branch information
NilashishC committed Jul 14, 2020
1 parent 1a17c12 commit a5357d0
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 39 deletions.
5 changes: 5 additions & 0 deletions tests/integration/targets/iosxr_config/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
- include: cli.yaml
- include: cli_config.yaml

- include: redirection.yaml
when: ansible_version.full is version('2.10.0', '>=')
tags:
- redirection
16 changes: 16 additions & 0 deletions tests/integration/targets/iosxr_config/tasks/redirection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: collect all redirection cli test cases
find:
paths: '{{ role_path }}/tests/redirection'
patterns: '{{ testcase }}.yaml'
register: shortname_test_cases
delegate_to: localhost

- name: set test_items for redirection
set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}"

- name: run test case (connection=ansible.netcommon.network_cli)
include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli'
with_items: '{{ test_items }}'
loop_control:
loop_var: test_case_to_run
26 changes: 0 additions & 26 deletions tests/integration/targets/iosxr_config/tests/cli/backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,4 @@
that:
- backup_file.files is defined

- name: use module alias to take configuration backup
register: result
cisco.iosxr.config:
backup: true
backup_options:
filename: backup_with_alias.cfg
dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}'
when: ansible_version.minor > 9

- assert:
that:
- result.changed == true
when: ansible_version.minor > 9

- name: check if the backup file-4 exist
find:
paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg'
register: backup_file
connection: local
when: ansible_version.minor > 9

- assert:
that:
- backup_file.files is defined
when: ansible_version.minor > 9

- debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}"
13 changes: 0 additions & 13 deletions tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,4 @@
- result.changed == false
- result.updates is not defined

- name: Use src with module alias
register: result
cisco.iosxr.config:
src: basic/config.j2
when: ansible_version.minor > 9

- assert:
that:
# make sure that the template content was read and not the path
- "result.changed == false"
- "result.updates is not defined"
when: ansible_version.minor > 9

- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- debug: msg="START redirection/shortname.yaml on connection={{ ansible_connection }}"

- name: Use src with module alias
register: result
cisco.iosxr.config:
src: basic/config.j2

- assert:
that:
# make sure that the template content was read and not the path
- result.changed == true
- result.updates is defined

- name: use module alias to take configuration backup
register: result
cisco.iosxr.config:
backup: true
backup_options:
filename: backup_with_alias.cfg
dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}'

- assert:
that:
- result.changed == true

- name: check if the backup file-4 exist
find:
paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg'
register: backup_file
connection: local

- assert:
that:
- backup_file.files is defined

- debug: msg="END redirection/shortname.yaml on connection={{ ansible_connection }}"

0 comments on commit a5357d0

Please sign in to comment.