-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirection tests should not run with 2.9
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
- Loading branch information
1 parent
1a17c12
commit a5357d0
Showing
5 changed files
with
58 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
tests/integration/targets/iosxr_config/tasks/redirection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |