From a12033a6e0ea280fbd5b3643b640ff39f434553b Mon Sep 17 00:00:00 2001 From: John R Barker Date: Fri, 20 Jan 2017 20:18:12 +0000 Subject: [PATCH] integration/targets/ios_* work to support IOS (#20414) * WIP * Don't set connection: network_cli in the playbook * ios_config tests now passing * Create test loopback device * delete * ios_* pass (apart from ios_facts) * Remove provider lines --- test/integration/ios.yaml | 1 - .../targets/ios_command/meta/main.yml | 2 + .../targets/ios_command/tasks/cli.yaml | 1 + .../ios_command/tests/cli/bad_operator.yaml | 1 - .../ios_command/tests/cli/contains.yaml | 7 ++- .../ios_command/tests/cli/invalid.yaml | 4 +- .../targets/ios_command/tests/cli/output.yaml | 5 +- .../ios_command/tests/cli/timeout.yaml | 1 - .../targets/ios_config/meta/main.yml | 2 + .../targets/ios_config/tasks/cli.yaml | 1 + .../targets/ios_config/tests/cli/backup.yaml | 5 +- .../ios_config/tests/cli/defaults.yaml | 6 +-- .../targets/ios_config/tests/cli/save.yaml | 3 -- .../ios_config/tests/cli/src_basic.yaml | 12 +++-- .../ios_config/tests/cli/src_invalid.yaml | 1 - .../ios_config/tests/cli/src_match_none.yaml | 6 +-- .../tests/cli/src_match_none.yaml.orig | 49 ------------------- .../ios_config/tests/cli/sublevel.yaml | 4 -- .../ios_config/tests/cli/sublevel_block.yaml | 4 -- .../ios_config/tests/cli/sublevel_exact.yaml | 4 -- .../ios_config/tests/cli/sublevel_strict.yaml | 4 -- .../ios_config/tests/cli/toplevel.yaml | 8 +-- .../ios_config/tests/cli/toplevel_after.yaml | 8 +-- .../ios_config/tests/cli/toplevel_before.yaml | 8 +-- .../tests/cli/toplevel_nonidempotent.yaml | 8 +-- .../targets/ios_facts/tasks/cli.yaml | 1 + .../ios_facts/tests/cli/all_facts.yaml | 1 - .../ios_facts/tests/cli/default_facts.yaml | 1 - .../ios_facts/tests/cli/invalid_subset.yaml | 2 - .../ios_facts/tests/cli/not_hardware.yaml | 1 - .../targets/ios_template/meta/main.yml | 2 + .../targets/ios_template/tasks/cli.yaml | 1 + .../ios_template/tests/cli/backup.yaml | 3 -- .../targets/ios_template/tests/cli/basic.yaml | 4 -- .../ios_template/tests/cli/defaults.yaml | 4 -- .../targets/ios_template/tests/cli/force.yaml | 4 -- .../targets/prepare_ios_tests/tasks/main.yml | 12 +++++ .../prepare_ios_tests/templates/config.j2 | 4 ++ 38 files changed, 53 insertions(+), 142 deletions(-) create mode 100644 test/integration/targets/ios_command/meta/main.yml create mode 100644 test/integration/targets/ios_config/meta/main.yml delete mode 100644 test/integration/targets/ios_config/tests/cli/src_match_none.yaml.orig create mode 100644 test/integration/targets/ios_template/meta/main.yml create mode 100644 test/integration/targets/prepare_ios_tests/tasks/main.yml create mode 100644 test/integration/targets/prepare_ios_tests/templates/config.j2 diff --git a/test/integration/ios.yaml b/test/integration/ios.yaml index 2010d29b62..09ff697138 100644 --- a/test/integration/ios.yaml +++ b/test/integration/ios.yaml @@ -1,7 +1,6 @@ --- - hosts: ios gather_facts: no - connection: local vars: limit_to: "*" diff --git a/test/integration/targets/ios_command/meta/main.yml b/test/integration/targets/ios_command/meta/main.yml new file mode 100644 index 0000000000..159cea8d38 --- /dev/null +++ b/test/integration/targets/ios_command/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_ios_tests diff --git a/test/integration/targets/ios_command/tasks/cli.yaml b/test/integration/targets/ios_command/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/ios_command/tasks/cli.yaml +++ b/test/integration/targets/ios_command/tasks/cli.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/ios_command/tests/cli/bad_operator.yaml b/test/integration/targets/ios_command/tests/cli/bad_operator.yaml index 38885b1488..3c97148f16 100644 --- a/test/integration/targets/ios_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/ios_command/tests/cli/bad_operator.yaml @@ -8,7 +8,6 @@ - show interfaces GigabitEthernet 0/0 wait_for: - "result[0] contains 'Description: Foo'" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/ios_command/tests/cli/contains.yaml b/test/integration/targets/ios_command/tests/cli/contains.yaml index 2777d887bd..1b4e5f6cf3 100644 --- a/test/integration/targets/ios_command/tests/cli/contains.yaml +++ b/test/integration/targets/ios_command/tests/cli/contains.yaml @@ -5,11 +5,10 @@ ios_command: commands: - show version - - show interface GigabitEthernet0/0 + - show interface loopback 888 wait_for: - - "result[0] contains 15.6" - - "result[1] contains GigabitEthernet0/0" - provider: "{{ cli }}" + - "result[0] contains Cisco" + - "result[1] contains Loopback888" register: result - assert: diff --git a/test/integration/targets/ios_command/tests/cli/invalid.yaml b/test/integration/targets/ios_command/tests/cli/invalid.yaml index 597d50746e..fc02aac599 100644 --- a/test/integration/targets/ios_command/tests/cli/invalid.yaml +++ b/test/integration/targets/ios_command/tests/cli/invalid.yaml @@ -3,8 +3,7 @@ - name: run invalid command ios_command: - commands: ['show foo'] - provider: "{{ cli }}" + commands: show foo register: result ignore_errors: yes @@ -17,7 +16,6 @@ commands: - show version - show foo - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/ios_command/tests/cli/output.yaml b/test/integration/targets/ios_command/tests/cli/output.yaml index 827349765c..698b3f0c3a 100644 --- a/test/integration/targets/ios_command/tests/cli/output.yaml +++ b/test/integration/targets/ios_command/tests/cli/output.yaml @@ -3,8 +3,8 @@ - name: get output for single command ios_command: - commands: ['show version'] - provider: "{{ cli }}" + commands: + - show version register: result - assert: @@ -17,7 +17,6 @@ commands: - show version - show interfaces - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/ios_command/tests/cli/timeout.yaml b/test/integration/targets/ios_command/tests/cli/timeout.yaml index 6b43fee973..a58c3b839a 100644 --- a/test/integration/targets/ios_command/tests/cli/timeout.yaml +++ b/test/integration/targets/ios_command/tests/cli/timeout.yaml @@ -7,7 +7,6 @@ - show version wait_for: - "result[0] contains bad_value_string" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/ios_config/meta/main.yml b/test/integration/targets/ios_config/meta/main.yml new file mode 100644 index 0000000000..159cea8d38 --- /dev/null +++ b/test/integration/targets/ios_config/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_ios_tests diff --git a/test/integration/targets/ios_config/tasks/cli.yaml b/test/integration/targets/ios_config/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/ios_config/tasks/cli.yaml +++ b/test/integration/targets/ios_config/tasks/cli.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/ios_config/tests/cli/backup.yaml b/test/integration/targets/ios_config/tests/cli/backup.yaml index 68a337adee..6549e9b319 100644 --- a/test/integration/targets/ios_config/tests/cli/backup.yaml +++ b/test/integration/targets/ios_config/tests/cli/backup.yaml @@ -9,7 +9,6 @@ parents: - interface Loopback999 match: none - provider: "{{ cli }}" - name: collect any backup files find: @@ -28,13 +27,13 @@ ios_config: src: basic/config.j2 backup: yes - provider: "{{ cli }}" register: result - assert: that: - "result.changed == true" - - "result.updates is not defined" +# FIXME Bug https://github.com/ansible/ansible/issues/19382 +# - "result.updates is not defined" - name: collect any backup files find: diff --git a/test/integration/targets/ios_config/tests/cli/defaults.yaml b/test/integration/targets/ios_config/tests/cli/defaults.yaml index b78b589d45..aec73f9fe6 100644 --- a/test/integration/targets/ios_config/tests/cli/defaults.yaml +++ b/test/integration/targets/ios_config/tests/cli/defaults.yaml @@ -9,13 +9,11 @@ parents: - interface Loopback999 match: none - provider: "{{ cli }}" - name: configure device with defaults included ios_config: src: defaults/config.j2 defaults: yes - provider: "{{ cli }}" register: result - debug: var=result @@ -23,13 +21,13 @@ - assert: that: - "result.changed == true" - - "result.updates is not defined" +# FIXME Bug https://github.com/ansible/ansible/issues/19382 +# - "result.updates is not defined" - name: check device with defaults included ios_config: src: defaults/config.j2 defaults: yes - provider: "{{ cli }}" register: result - debug: var=result diff --git a/test/integration/targets/ios_config/tests/cli/save.yaml b/test/integration/targets/ios_config/tests/cli/save.yaml index a886210e61..cad199ca75 100644 --- a/test/integration/targets/ios_config/tests/cli/save.yaml +++ b/test/integration/targets/ios_config/tests/cli/save.yaml @@ -9,13 +9,11 @@ parents: - interface Loopback999 match: none - provider: "{{ cli }}" - name: save config ios_config: save: true - provider: "{{ cli }}" register: result # FIXME https://github.com/ansible/ansible-modules-core/issues/5008 ignore_errors: true @@ -29,7 +27,6 @@ - name: save should always run ios_config: save: true - provider: "{{ cli }}" register: result # FIXME https://github.com/ansible/ansible-modules-core/issues/5008 ignore_errors: true diff --git a/test/integration/targets/ios_config/tests/cli/src_basic.yaml b/test/integration/targets/ios_config/tests/cli/src_basic.yaml index 177d19f926..84b2a3b533 100644 --- a/test/integration/targets/ios_config/tests/cli/src_basic.yaml +++ b/test/integration/targets/ios_config/tests/cli/src_basic.yaml @@ -9,30 +9,32 @@ parents: - interface Loopback999 match: none - provider: "{{ cli }}" - name: configure device with config ios_config: src: basic/config.j2 - provider: "{{ cli }}" register: result +- name: debug, remove me + debug: + msg: "{{ result }}" - assert: that: - "result.changed == true" # https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" +# FIXME Bug https://github.com/ansible/ansible/issues/19382 +# - "result.updates is not defined" - name: check device with config ios_config: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" # https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" +# FIXME Bug https://github.com/ansible/ansible/issues/19382 +# - "result.updates is not defined" - debug: msg="END cli/src_basic.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/src_invalid.yaml b/test/integration/targets/ios_config/tests/cli/src_invalid.yaml index 5081f1a736..a06b743159 100644 --- a/test/integration/targets/ios_config/tests/cli/src_invalid.yaml +++ b/test/integration/targets/ios_config/tests/cli/src_invalid.yaml @@ -6,7 +6,6 @@ - name: configure with invalid src ios_config: src: basic/foobar.j2 - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/ios_config/tests/cli/src_match_none.yaml b/test/integration/targets/ios_config/tests/cli/src_match_none.yaml index b55d7a545b..38e1686bfd 100644 --- a/test/integration/targets/ios_config/tests/cli/src_match_none.yaml +++ b/test/integration/targets/ios_config/tests/cli/src_match_none.yaml @@ -9,12 +9,10 @@ parents: - interface Loopback999 match: none - provider: "{{ cli }}" - name: configure device with config ios_config: src: basic/config.j2 - provider: "{{ cli }}" match: none register: result @@ -22,12 +20,12 @@ that: - "result.changed == true" # https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" +# FIXME Bug https://github.com/ansible/ansible/issues/19382 +# - "result.updates is not defined" - name: check device with config ios_config: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/ios_config/tests/cli/src_match_none.yaml.orig b/test/integration/targets/ios_config/tests/cli/src_match_none.yaml.orig deleted file mode 100644 index 1e063d5ef7..0000000000 --- a/test/integration/targets/ios_config/tests/cli/src_match_none.yaml.orig +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: msg="START cli/src_match_none.yaml" - -- name: setup - ios_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - provider: "{{ cli }}" - -- name: configure device with config - ios_config: - src: basic/config.j2 - provider: "{{ cli }}" - match: none - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- name: check device with config - ios_config: - src: basic/config.j2 - provider: "{{ cli }}" -<<<<<<< f84b1d496e52b69dab38894e7ec7b90b63857331 -======= - match: none ->>>>>>> Tests for ios_config - register: result - -- assert: - that: - # Idempotent test -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.changed == false" - - "result.updates is not defined" -<<<<<<< f84b1d496e52b69dab38894e7ec7b90b63857331 -======= -# FIXME bug https://github.com/ansible/ansible-modules-core/issues/5003 - ignore_errors: true ->>>>>>> Tests for ios_config - -- debug: msg="END cli/src_match_none.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/sublevel.yaml b/test/integration/targets/ios_config/tests/cli/sublevel.yaml index a5b13a3a66..662564966b 100644 --- a/test/integration/targets/ios_config/tests/cli/sublevel.yaml +++ b/test/integration/targets/ios_config/tests/cli/sublevel.yaml @@ -6,14 +6,12 @@ lines: - 'no ip access-list extended test' - 'no ip access-list standard test' - provider: "{{ cli }}" match: none - name: configure sub level command ios_config: lines: ['permit ip any any log'] parents: ['ip access-list extended test'] - provider: "{{ cli }}" register: result - assert: @@ -26,7 +24,6 @@ ios_config: lines: ['permit ip any any log'] parents: ['ip access-list extended test'] - provider: "{{ cli }}" register: result - assert: @@ -37,7 +34,6 @@ ios_config: lines: - 'no ip access-list extended test' - provider: "{{ cli }}" match: none - debug: msg="END cli/sublevel.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/sublevel_block.yaml b/test/integration/targets/ios_config/tests/cli/sublevel_block.yaml index 142ed6ee86..6753dba66b 100644 --- a/test/integration/targets/ios_config/tests/cli/sublevel_block.yaml +++ b/test/integration/targets/ios_config/tests/cli/sublevel_block.yaml @@ -10,7 +10,6 @@ parents: ['ip access-list extended test'] before: ['no ip access-list extended test'] after: ['exit'] - provider: "{{ cli }}" match: none - name: configure sub level command using block resplace @@ -23,7 +22,6 @@ parents: ['ip access-list extended test'] replace: block after: ['exit'] - provider: "{{ cli }}" register: result - assert: @@ -45,7 +43,6 @@ parents: ['ip access-list extended test'] replace: block after: ['exit'] - provider: "{{ cli }}" register: result - assert: @@ -57,6 +54,5 @@ lines: - no ip access-list extended test match: none - provider: "{{ cli }}" - debug: msg="END cli/sublevel_block.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/ios_config/tests/cli/sublevel_exact.yaml index 0ef170ffcb..baec330300 100644 --- a/test/integration/targets/ios_config/tests/cli/sublevel_exact.yaml +++ b/test/integration/targets/ios_config/tests/cli/sublevel_exact.yaml @@ -13,7 +13,6 @@ before: no ip access-list extended test after: exit match: none - provider: "{{ cli }}" - name: configure sub level command using exact match ios_config: @@ -26,7 +25,6 @@ before: no ip access-list extended test after: exit match: exact - provider: "{{ cli }}" register: result - assert: @@ -48,7 +46,6 @@ - permit ip host 4.4.4.4 any log parents: ip access-list extended test match: exact - provider: "{{ cli }}" register: result - assert: @@ -60,6 +57,5 @@ lines: - no ip access-list extended test match: none - provider: "{{ cli }}" - debug: msg="END cli/sublevel_exact.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/ios_config/tests/cli/sublevel_strict.yaml index f626b94f2d..f227ffcc9f 100644 --- a/test/integration/targets/ios_config/tests/cli/sublevel_strict.yaml +++ b/test/integration/targets/ios_config/tests/cli/sublevel_strict.yaml @@ -12,7 +12,6 @@ parents: ip access-list extended test before: no ip access-list extended test match: none - provider: "{{ cli }}" - name: configure sub level command using strict match ios_config: @@ -23,7 +22,6 @@ - permit ip host 4.4.4.4 any log parents: ip access-list extended test match: strict - provider: "{{ cli }}" register: result - assert: @@ -39,7 +37,6 @@ parents: ip access-list extended test after: exit match: strict - provider: "{{ cli }}" register: result - assert: @@ -56,6 +53,5 @@ ios_config: lines: no ip access-list extended test match: none - provider: "{{ cli }}" - debug: msg="END cli/sublevel_strict.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/toplevel.yaml b/test/integration/targets/ios_config/tests/cli/toplevel.yaml index 59f4f50c23..9f62d4388e 100644 --- a/test/integration/targets/ios_config/tests/cli/toplevel.yaml +++ b/test/integration/targets/ios_config/tests/cli/toplevel.yaml @@ -3,14 +3,12 @@ - name: setup ios_config: - lines: ['hostname {{ inventory_hostname_short }}'] - provider: "{{ cli }}" + lines: ['hostname {{ shorter_hostname }}'] match: none - name: configure top level command ios_config: lines: ['hostname foo'] - provider: "{{ cli }}" register: result - assert: @@ -21,7 +19,6 @@ - name: configure top level command idempotent check ios_config: lines: ['hostname foo'] - provider: "{{ cli }}" register: result - assert: @@ -30,8 +27,7 @@ - name: teardown ios_config: - lines: ['hostname {{ inventory_hostname_short }}'] - provider: "{{ cli }}" + lines: ['hostname {{ shorter_hostname }}'] match: none - debug: msg="END cli/toplevel.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/toplevel_after.yaml b/test/integration/targets/ios_config/tests/cli/toplevel_after.yaml index e3182491c2..a2333531bd 100644 --- a/test/integration/targets/ios_config/tests/cli/toplevel_after.yaml +++ b/test/integration/targets/ios_config/tests/cli/toplevel_after.yaml @@ -5,15 +5,13 @@ ios_config: lines: - "snmp-server contact ansible" - - "hostname {{ inventory_hostname_short }}" - provider: "{{ cli }}" + - "hostname {{ shorter_hostname }}" match: none - name: configure top level command with before ios_config: lines: ['hostname foo'] after: ['snmp-server contact bar'] - provider: "{{ cli }}" register: result - assert: @@ -26,7 +24,6 @@ ios_config: lines: ['hostname foo'] after: ['snmp-server contact foo'] - provider: "{{ cli }}" register: result - assert: @@ -37,8 +34,7 @@ ios_config: lines: - "no snmp-server contact" - - "hostname {{ inventory_hostname_short }}" - provider: "{{ cli }}" + - "hostname {{ shorter_hostname }}" match: none - debug: msg="END cli/toplevel_after.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/toplevel_before.yaml b/test/integration/targets/ios_config/tests/cli/toplevel_before.yaml index b459bf194c..eff481be2b 100644 --- a/test/integration/targets/ios_config/tests/cli/toplevel_before.yaml +++ b/test/integration/targets/ios_config/tests/cli/toplevel_before.yaml @@ -5,15 +5,13 @@ ios_config: lines: - "snmp-server contact ansible" - - "hostname {{ inventory_hostname_short }}" - provider: "{{ cli }}" + - "hostname {{ shorter_hostname }}" match: none - name: configure top level command with before ios_config: lines: ['hostname foo'] before: ['snmp-server contact bar'] - provider: "{{ cli }}" register: result - assert: @@ -26,7 +24,6 @@ ios_config: lines: ['hostname foo'] before: ['snmp-server contact foo'] - provider: "{{ cli }}" register: result - assert: @@ -37,8 +34,7 @@ ios_config: lines: - "no snmp-server contact" - - "hostname {{ inventory_hostname_short }}" - provider: "{{ cli }}" + - "hostname {{ shorter_hostname }}" match: none - debug: msg="END cli/toplevel_before.yaml" diff --git a/test/integration/targets/ios_config/tests/cli/toplevel_nonidempotent.yaml b/test/integration/targets/ios_config/tests/cli/toplevel_nonidempotent.yaml index 05343549e2..ce787bbdb4 100644 --- a/test/integration/targets/ios_config/tests/cli/toplevel_nonidempotent.yaml +++ b/test/integration/targets/ios_config/tests/cli/toplevel_nonidempotent.yaml @@ -3,14 +3,12 @@ - name: setup ios_config: - lines: ['hostname {{ inventory_hostname_short }}'] - provider: "{{ cli }}" + lines: ['hostname {{ shorter_hostname }}'] match: none - name: configure top level command ios_config: lines: ['hostname foo'] - provider: "{{ cli }}" match: strict register: result @@ -22,7 +20,6 @@ - name: configure top level command idempotent check ios_config: lines: ['hostname foo'] - provider: "{{ cli }}" match: strict register: result @@ -32,8 +29,7 @@ - name: teardown ios_config: - lines: ['hostname {{ inventory_hostname_short }}'] - provider: "{{ cli }}" + lines: ['hostname {{ shorter_hostname }}'] match: none - debug: msg="END cli/toplevel_nonidempotent.yaml" diff --git a/test/integration/targets/ios_facts/tasks/cli.yaml b/test/integration/targets/ios_facts/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/ios_facts/tasks/cli.yaml +++ b/test/integration/targets/ios_facts/tasks/cli.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/ios_facts/tests/cli/all_facts.yaml b/test/integration/targets/ios_facts/tests/cli/all_facts.yaml index c6e9219e7a..4ef922a46c 100644 --- a/test/integration/targets/ios_facts/tests/cli/all_facts.yaml +++ b/test/integration/targets/ios_facts/tests/cli/all_facts.yaml @@ -4,7 +4,6 @@ - name: test getting all facts ios_facts: - provider: "{{ cli }}" gather_subset: - all register: result diff --git a/test/integration/targets/ios_facts/tests/cli/default_facts.yaml b/test/integration/targets/ios_facts/tests/cli/default_facts.yaml index 2218fc6860..422adfc618 100644 --- a/test/integration/targets/ios_facts/tests/cli/default_facts.yaml +++ b/test/integration/targets/ios_facts/tests/cli/default_facts.yaml @@ -4,7 +4,6 @@ - name: test getting default facts ios_facts: - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/ios_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/ios_facts/tests/cli/invalid_subset.yaml index b0c2799254..f4aabca3b8 100644 --- a/test/integration/targets/ios_facts/tests/cli/invalid_subset.yaml +++ b/test/integration/targets/ios_facts/tests/cli/invalid_subset.yaml @@ -4,7 +4,6 @@ - name: test invalid subset (foobar) ios_facts: - provider: "{{ cli }}" gather_subset: - "foobar" register: result @@ -26,7 +25,6 @@ - name: test subset specified multiple times ios_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" - "hardware" diff --git a/test/integration/targets/ios_facts/tests/cli/not_hardware.yaml b/test/integration/targets/ios_facts/tests/cli/not_hardware.yaml index 319e4bcc2c..ca4d0d9681 100644 --- a/test/integration/targets/ios_facts/tests/cli/not_hardware.yaml +++ b/test/integration/targets/ios_facts/tests/cli/not_hardware.yaml @@ -4,7 +4,6 @@ - name: test not hardware ios_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" register: result diff --git a/test/integration/targets/ios_template/meta/main.yml b/test/integration/targets/ios_template/meta/main.yml new file mode 100644 index 0000000000..159cea8d38 --- /dev/null +++ b/test/integration/targets/ios_template/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_ios_tests diff --git a/test/integration/targets/ios_template/tasks/cli.yaml b/test/integration/targets/ios_template/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/ios_template/tasks/cli.yaml +++ b/test/integration/targets/ios_template/tasks/cli.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/ios_template/tests/cli/backup.yaml b/test/integration/targets/ios_template/tests/cli/backup.yaml index df8e521d7d..795d8bf4c0 100644 --- a/test/integration/targets/ios_template/tests/cli/backup.yaml +++ b/test/integration/targets/ios_template/tests/cli/backup.yaml @@ -6,7 +6,6 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" ignore_errors: yes - name: collect any backup files @@ -26,7 +25,6 @@ ios_template: src: basic/config.j2 backup: yes - provider: "{{ cli }}" register: result - assert: @@ -50,6 +48,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/backup.yaml" diff --git a/test/integration/targets/ios_template/tests/cli/basic.yaml b/test/integration/targets/ios_template/tests/cli/basic.yaml index 2fd9ef0423..4f70933847 100644 --- a/test/integration/targets/ios_template/tests/cli/basic.yaml +++ b/test/integration/targets/ios_template/tests/cli/basic.yaml @@ -6,13 +6,11 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" ignore_errors: yes - name: configure device with config ios_template: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: @@ -23,7 +21,6 @@ - name: check device with config ios_template: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: @@ -36,6 +33,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/basic.yaml" diff --git a/test/integration/targets/ios_template/tests/cli/defaults.yaml b/test/integration/targets/ios_template/tests/cli/defaults.yaml index 95015568cd..bb3c61552c 100644 --- a/test/integration/targets/ios_template/tests/cli/defaults.yaml +++ b/test/integration/targets/ios_template/tests/cli/defaults.yaml @@ -5,14 +5,12 @@ ios_config: commands: no interface Loopback999 match: none - provider: "{{ cli }}" ignore_errors: yes - name: configure device with defaults included ios_template: src: defaults/config.j2 include_defaults: yes - provider: "{{ cli }}" register: result - assert: @@ -24,7 +22,6 @@ ios_template: src: defaults/config.j2 include_defaults: yes - provider: "{{ cli }}" register: result - assert: @@ -36,6 +33,5 @@ ios_config: commands: no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/defaults.yaml" diff --git a/test/integration/targets/ios_template/tests/cli/force.yaml b/test/integration/targets/ios_template/tests/cli/force.yaml index d784fd0f1c..c5b4f6ca04 100644 --- a/test/integration/targets/ios_template/tests/cli/force.yaml +++ b/test/integration/targets/ios_template/tests/cli/force.yaml @@ -6,13 +6,11 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" ignore_errors: yes - name: configure device with config ios_template: src: basic/config.j2 - provider: "{{ cli }}" force: yes register: result @@ -24,7 +22,6 @@ - name: check device with config ios_template: src: basic/config.j2 - provider: "{{ cli }}" force: yes register: result @@ -38,6 +35,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/force.yaml" diff --git a/test/integration/targets/prepare_ios_tests/tasks/main.yml b/test/integration/targets/prepare_ios_tests/tasks/main.yml new file mode 100644 index 0000000000..fbf3ac8620 --- /dev/null +++ b/test/integration/targets/prepare_ios_tests/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Ensure we have loopback 888 for testing + ios_config: + src: config.j2 + + +# Some AWS hostnames can be longer than those allowed by the system we are testing +# Truncate the hostname +# http://jinja.pocoo.org/docs/2.9/templates/#truncate +- set_fact: + shorter_hostname: '{{ inventory_hostname_short| truncate(10, True, "") }}' diff --git a/test/integration/targets/prepare_ios_tests/templates/config.j2 b/test/integration/targets/prepare_ios_tests/templates/config.j2 new file mode 100644 index 0000000000..c8eb3457f9 --- /dev/null +++ b/test/integration/targets/prepare_ios_tests/templates/config.j2 @@ -0,0 +1,4 @@ +interface Loopback888 + description test for ansible + shutdown +