diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/dellemc/os10/tests/integration | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/dellemc/os10/tests/integration')
23 files changed, 620 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/defaults/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/defaults/main.yaml new file mode 100644 index 00000000..5f709c5a --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/cli.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/cli.yaml new file mode 100644 index 00000000..8c11e106 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/main.yaml new file mode 100644 index 00000000..415c99d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/bad_operator.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/bad_operator.yaml new file mode 100644 index 00000000..1fd619b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/bad_operator.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/bad_operator.yaml" + +- name: test bad operator + os10_command: + commands: + - show version + - show interface ethernet 1/1/1 + wait_for: + - "result[0] contains 'Description : blah'" + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/bad_operator.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/contains.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/contains.yaml new file mode 100644 index 00000000..77aac00b --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/contains.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/contains.yaml" + +- name: test contains operator + os10_command: + commands: + - show version + - show interface ethernet 1/1/1 + wait_for: + - "result[0] contains OS10-Premium" + - "result[1] contains Ethernet " + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/contains.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/invalid.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/invalid.yaml new file mode 100644 index 00000000..6c8aefe1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/invalid.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/invalid.yaml" + +- name: run invalid command + os10_command: + commands: ['show foo'] + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "'Error: Unrecognized command' in result.stdout" + +- name: run commands that include invalid command + os10_command: + commands: + - show version + - show foo + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "'Error: Unrecognized command' in result.stdout" + +- debug: msg="END cli/invalid.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/output.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/output.yaml new file mode 100644 index 00000000..48749b2c --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/output.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START cli/output.yaml" + +- name: get output for single command + os10_command: + commands: ['show version'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: get output for multiple commands + os10_command: + commands: + - show version + - show interface Eth 1/1/1 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + - "result.stdout | length == 2" + +- debug: msg="END cli/output.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/timeout.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/timeout.yaml new file mode 100644 index 00000000..d3da30bb --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_command/os10_command/tests/cli/timeout.yaml @@ -0,0 +1,19 @@ +--- +- debug: msg="START cli/timeout.yaml" + +- name: test bad condition + os10_command: + commands: + - show version + wait_for: + - "result[0] contains bad_value_string" + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/timeout.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/defaults/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/defaults/main.yaml new file mode 100644 index 00000000..5f709c5a --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/cli.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/cli.yaml new file mode 100644 index 00000000..d675462d --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/cli.yaml @@ -0,0 +1,15 @@ +--- +- name: collect all cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/main.yaml new file mode 100644 index 00000000..415c99d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel.yaml new file mode 100644 index 00000000..2fa9951a --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START cli/sublevel.yaml" + +- name: setup test + os10_config: + lines: + - 'no ip access-list test' + provider: "{{ cli }}" + match: none + +- name: configure sub level command + os10_config: + lines: ['seq 5 permit ip any any count byte'] + parents: ['ip access-list test'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'seq 5 permit ip any any count byte' in result.updates" + +- name: configure sub level command idempotent check + os10_config: + lines: ['seq 5 permit ip any any count byte'] + parents: ['ip access-list test'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: + - 'no ip access-list test' + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/sublevel.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_block.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_block.yaml new file mode 100644 index 00000000..32fe1bde --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_block.yaml @@ -0,0 +1,62 @@ +--- +- debug: msg="START cli/sublevel_block.yaml" + +- name: setup + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + parents: ['ip access-list test'] + before: ['no ip access-list test'] + after: ['exit'] + provider: "{{ cli }}" + match: none + +- name: configure sub level command using block resplace + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + parents: ['ip access-list test'] + replace: block + after: ['exit'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'seq 5 permit ip host 192.0.2.1 any count byte' in result.updates" + - "'seq 10 permit ip host 192.0.2.2 any count byte' in result.updates" + - "'seq 15 permit ip host 192.0.2.3 any count byte' in result.updates" + - "'seq 20 permit ip host 192.0.2.4 any count byte' in result.updates" + +- name: check sub level command using block replace + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + parents: ['ip access-list test'] + replace: block + after: ['exit'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: + - no ip access-list test + match: none + provider: "{{ cli }}" + +- debug: msg="END cli/sublevel_block.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_exact.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_exact.yaml new file mode 100644 index 00000000..d4dcd8ac --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_exact.yaml @@ -0,0 +1,66 @@ +--- +- debug: msg="START cli/sublevel_exact.yaml" + +- name: setup + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + - seq 25 permit ip host 192.0.2.5 any count byte + parents: ['ip access-list test'] + before: ['no ip access-list test'] + after: ['exit'] + provider: "{{ cli }}" + match: none + +- name: configure sub level command using exact match + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + parents: ['ip access-list test'] + after: ['exit'] + match: exact + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'seq 5 permit ip host 192.0.2.1 any count byte' in result.updates" + - "'seq 10 permit ip host 192.0.2.2 any count byte' in result.updates" + - "'seq 15 permit ip host 192.0.2.3 any count byte' in result.updates" + - "'seq 20 permit ip host 192.0.2.4 any count byte' in result.updates" + - "'seq 25 permit ip host 192.0.2.5 any count byte' not in result.updates" + +- name: check sub level command using exact match + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + - seq 25 permit ip host 192.0.2.5 any count byte + parents: ['ip access-list test'] + after: ['exit'] + match: exact + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: + - no ip access-list test + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/sublevel_exact.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_strict.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_strict.yaml new file mode 100644 index 00000000..94c85eb2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/sublevel_strict.yaml @@ -0,0 +1,63 @@ +--- +- debug: msg="START cli/sublevel_strict.yaml" + +- name: setup + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + - seq 25 permit ip host 192.0.2.5 any count byte + parents: ['ip access-list test'] + before: ['no ip access-list test'] + after: ['exit'] + provider: "{{ cli }}" + match: none + +- name: configure sub level command using strict match + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 20 permit ip host 192.0.2.4 any count byte + parents: ['ip access-list test'] + match: strict + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: check sub level command using strict match + os10_config: + lines: + - seq 5 permit ip host 192.0.2.1 any count byte + - seq 15 permit ip host 192.0.2.3 any count byte + - seq 10 permit ip host 192.0.2.2 any count byte + parents: ['ip access-list test'] + after: ['exit'] + match: strict + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'seq 5 permit ip host 192.0.2.1 any count byte' not in result.updates" + - "'seq 10 permit ip host 192.0.2.2 any count byte' in result.updates" + - "'seq 15 permit ip host 192.0.2.3 any count byte' in result.updates" + - "'seq 20 permit ip host 192.0.2.4 any count byte' not in result.updates" + - "'seq 25 permit ip host 192.0.2.5 any count byte' not in result.updates" + +- name: teardown + os10_config: + lines: + - no ip access-list test + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/sublevel_strict.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel.yaml new file mode 100644 index 00000000..e148a46d --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START cli/toplevel.yaml" + +- name: setup + os10_config: + lines: ['hostname {{ inventory_hostname_short }}'] + provider: "{{ cli }}" + match: none + +- name: configure top level command + os10_config: + lines: ['hostname foo'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'hostname foo' in result.updates" + +- name: configure top level command idempotent check + os10_config: + lines: ['hostname foo'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: ['hostname {{ inventory_hostname_short }}'] + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/toplevel.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_after.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_after.yaml new file mode 100644 index 00000000..94122739 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_after.yaml @@ -0,0 +1,44 @@ +--- +- debug: msg="START cli/toplevel_after.yaml" + +- name: setup + os10_config: + lines: + - "snmp-server contact ansible" + - "hostname {{ inventory_hostname_short }}" + provider: "{{ cli }}" + match: none + +- name: configure top level command with before + os10_config: + lines: ['hostname foo'] + after: ['snmp-server contact bar'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'hostname foo' in result.updates" + - "'snmp-server contact bar' in result.updates" + +- name: configure top level command with before idempotent check + os10_config: + lines: ['hostname foo'] + after: ['snmp-server contact foo'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: + - "no snmp-server contact" + - "hostname {{ inventory_hostname_short }}" + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/toplevel_after.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_before.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_before.yaml new file mode 100644 index 00000000..da8b604e --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_before.yaml @@ -0,0 +1,44 @@ +--- +- debug: msg="START cli/toplevel_before.yaml" + +- name: setup + os10_config: + lines: + - "snmp-server contact ansible" + - "hostname {{ inventory_hostname_short }}" + provider: "{{ cli }}" + match: none + +- name: configure top level command with before + os10_config: + lines: ['hostname foo'] + before: ['snmp-server contact bar'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + - "'hostname foo' in result.updates" + - "'snmp-server contact bar' in result.updates" + +- name: configure top level command with before idempotent check + os10_config: + lines: ['hostname foo'] + before: ['snmp-server contact foo'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + os10_config: + lines: + - "no snmp-server contact" + - "hostname {{ inventory_hostname_short }}" + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/toplevel_before.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_nonidempotent.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_nonidempotent.yaml new file mode 100644 index 00000000..03f5ade1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_config/os10_config/tests/cli/toplevel_nonidempotent.yaml @@ -0,0 +1,39 @@ +--- +- debug: msg="START cli/toplevel_nonidempotent.yaml" + +- name: setup + os10_config: + lines: ['hostname {{ inventory_hostname_short }}'] + provider: "{{ cli }}" + match: none + +- name: configure top level command + os10_config: + lines: ['hostname foo'] + provider: "{{ cli }}" + match: strict + register: result + +- assert: + that: + - "result.changed == true" + - "'hostname foo' in result.updates" + +- name: configure top level command idempotent check + os10_config: + lines: ['hostname foo'] + provider: "{{ cli }}" + match: strict + register: result + +- assert: + that: + - "result.changed == true" + +- name: teardown + os10_config: + lines: ['hostname {{ inventory_hostname_short }}'] + provider: "{{ cli }}" + match: none + +- debug: msg="END cli/toplevel_nonidempotent.yaml" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/defaults/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/defaults/main.yaml new file mode 100644 index 00000000..5f709c5a --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/cli.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/cli.yaml new file mode 100644 index 00000000..8c11e106 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/main.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/main.yaml new file mode 100644 index 00000000..415c99d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tests/cli/facts.yaml b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tests/cli/facts.yaml new file mode 100644 index 00000000..d5b45e1d --- /dev/null +++ b/collections-debian-merged/ansible_collections/dellemc/os10/tests/integration/targets/os10_facts/os10_facts/tests/cli/facts.yaml @@ -0,0 +1,48 @@ +--- +- debug: msg="START cli/facts.yaml" + +- name: test all facts + os10_facts: + gather_subset: + - all + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.ansible_facts is defined" + - "result.ansible_facts.ansible_net_interfaces is defined" + - "result.ansible_facts.ansible_net_memfree_mb is defined" + - "result.ansible_facts.ansible_net_model is defined" + - "result.ansible_facts.ansible_net_servicetag is defined" + - "result.ansible_facts.ansible_net_version is defined" + +- name: test all facts except hardware + os10_facts: + gather_subset: + - "!hardware" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.ansible_facts.ansible_net_interfaces is defined" + - "result.ansible_facts.ansible_net_memfree_mb is not defined" + +- name: test interface facts + os10_facts: + gather_subset: + - interfaces + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.ansible_facts.ansible_net_interfaces is defined" + - "result.ansible_facts.ansible_net_memfree_mb is not defined" + + +- debug: msg="END cli/facts.yaml" |