From 458cc38992df527b058813dfe99d04eed9c062c4 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Mon, 8 Jan 2018 23:22:53 +0530 Subject: [PATCH] Fix connection type in junos integration tests (#34583) * Fix connection type in junos integration tests * For find module in junos integration test add connection type local and delegate task to localhost * Fix review comment --- test/integration/targets/junos_banner/tasks/netconf.yaml | 1 + .../targets/junos_command/tasks/netconf_json.yaml | 1 + .../targets/junos_command/tasks/netconf_text.yaml | 1 + .../integration/targets/junos_command/tasks/netconf_xml.yaml | 1 + test/integration/targets/junos_config/tasks/netconf.yaml | 1 + .../targets/junos_config/tests/netconf/backup.yaml | 5 +++-- test/integration/targets/junos_facts/tasks/netconf.yaml | 1 + test/integration/targets/junos_interface/tasks/netconf.yaml | 2 +- .../targets/junos_l3_interface/tasks/netconf.yaml | 2 +- test/integration/targets/junos_linkagg/tasks/netconf.yaml | 2 +- test/integration/targets/junos_lldp/tasks/netconf.yaml | 2 +- .../targets/junos_lldp_interface/tasks/netconf.yaml | 2 +- test/integration/targets/junos_logging/tasks/netconf.yaml | 2 +- test/integration/targets/junos_netconf/tasks/cli.yaml | 1 + test/integration/targets/junos_rpc/tasks/netconf.yaml | 1 + .../targets/junos_static_route/tasks/netconf.yaml | 2 +- test/integration/targets/junos_system/tasks/netconf.yaml | 2 +- test/integration/targets/junos_user/tasks/netconf.yaml | 1 + test/integration/targets/junos_vlan/tasks/netconf.yaml | 1 + test/integration/targets/junos_vrf/tasks/netconf.yaml | 1 + 20 files changed, 22 insertions(+), 10 deletions(-) diff --git a/test/integration/targets/junos_banner/tasks/netconf.yaml b/test/integration/targets/junos_banner/tasks/netconf.yaml index 337b000896a..95502101025 100644 --- a/test/integration/targets/junos_banner/tasks/netconf.yaml +++ b/test/integration/targets/junos_banner/tasks/netconf.yaml @@ -2,6 +2,7 @@ find: paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_command/tasks/netconf_json.yaml b/test/integration/targets/junos_command/tasks/netconf_json.yaml index b31e9996fb4..5859e29d18e 100644 --- a/test/integration/targets/junos_command/tasks/netconf_json.yaml +++ b/test/integration/targets/junos_command/tasks/netconf_json.yaml @@ -3,6 +3,7 @@ find: paths: "{{ role_path }}/tests/netconf_json" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_command/tasks/netconf_text.yaml b/test/integration/targets/junos_command/tasks/netconf_text.yaml index 12f1449c9ae..5ecf68d7684 100644 --- a/test/integration/targets/junos_command/tasks/netconf_text.yaml +++ b/test/integration/targets/junos_command/tasks/netconf_text.yaml @@ -3,6 +3,7 @@ find: paths: "{{ role_path }}/tests/netconf_text" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_command/tasks/netconf_xml.yaml b/test/integration/targets/junos_command/tasks/netconf_xml.yaml index 5dbdd8b88ab..288bed2e50f 100644 --- a/test/integration/targets/junos_command/tasks/netconf_xml.yaml +++ b/test/integration/targets/junos_command/tasks/netconf_xml.yaml @@ -3,6 +3,7 @@ find: paths: "{{ role_path }}/tests/netconf_xml" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_config/tasks/netconf.yaml b/test/integration/targets/junos_config/tasks/netconf.yaml index c66de84ca94..59ef55adcd7 100644 --- a/test/integration/targets/junos_config/tasks/netconf.yaml +++ b/test/integration/targets/junos_config/tasks/netconf.yaml @@ -3,6 +3,7 @@ find: paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_config/tests/netconf/backup.yaml b/test/integration/targets/junos_config/tests/netconf/backup.yaml index 0bdcb0c6e8f..09f7ddc943e 100644 --- a/test/integration/targets/junos_config/tests/netconf/backup.yaml +++ b/test/integration/targets/junos_config/tests/netconf/backup.yaml @@ -13,12 +13,13 @@ paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - name: delete backup files file: path: "{{ item.path }}" state: absent + connection: local with_items: "{{backup_files.files|default([])}}" - name: configure device with config @@ -38,7 +39,7 @@ paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - assert: that: diff --git a/test/integration/targets/junos_facts/tasks/netconf.yaml b/test/integration/targets/junos_facts/tasks/netconf.yaml index 337b000896a..95502101025 100644 --- a/test/integration/targets/junos_facts/tasks/netconf.yaml +++ b/test/integration/targets/junos_facts/tasks/netconf.yaml @@ -2,6 +2,7 @@ find: paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: set test_items diff --git a/test/integration/targets/junos_interface/tasks/netconf.yaml b/test/integration/targets/junos_interface/tasks/netconf.yaml index 92fc7092cd6..8c95360c6b7 100644 --- a/test/integration/targets/junos_interface/tasks/netconf.yaml +++ b/test/integration/targets/junos_interface/tasks/netconf.yaml @@ -3,8 +3,8 @@ find: paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" + connection: local 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/junos_l3_interface/tasks/netconf.yaml b/test/integration/targets/junos_l3_interface/tasks/netconf.yaml index 92fc7092cd6..8c95360c6b7 100644 --- a/test/integration/targets/junos_l3_interface/tasks/netconf.yaml +++ b/test/integration/targets/junos_l3_interface/tasks/netconf.yaml @@ -3,8 +3,8 @@ find: paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" + connection: local 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/junos_linkagg/tasks/netconf.yaml b/test/integration/targets/junos_linkagg/tasks/netconf.yaml index 92fc7092cd6..c1985c530ad 100644 --- a/test/integration/targets/junos_linkagg/tasks/netconf.yaml +++ b/test/integration/targets/junos_linkagg/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_lldp/tasks/netconf.yaml b/test/integration/targets/junos_lldp/tasks/netconf.yaml index 92fc7092cd6..c1985c530ad 100644 --- a/test/integration/targets/junos_lldp/tasks/netconf.yaml +++ b/test/integration/targets/junos_lldp/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_lldp_interface/tasks/netconf.yaml b/test/integration/targets/junos_lldp_interface/tasks/netconf.yaml index cf8474a3506..f73ce8727f4 100644 --- a/test/integration/targets/junos_lldp_interface/tasks/netconf.yaml +++ b/test/integration/targets/junos_lldp_interface/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_logging/tasks/netconf.yaml b/test/integration/targets/junos_logging/tasks/netconf.yaml index 92fc7092cd6..c1985c530ad 100644 --- a/test/integration/targets/junos_logging/tasks/netconf.yaml +++ b/test/integration/targets/junos_logging/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_netconf/tasks/cli.yaml b/test/integration/targets/junos_netconf/tasks/cli.yaml index 9499440de78..1faa514d5c7 100644 --- a/test/integration/targets/junos_netconf/tasks/cli.yaml +++ b/test/integration/targets/junos_netconf/tasks/cli.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_rpc/tasks/netconf.yaml b/test/integration/targets/junos_rpc/tasks/netconf.yaml index 337b000896a..24181dcf382 100644 --- a/test/integration/targets/junos_rpc/tasks/netconf.yaml +++ b/test/integration/targets/junos_rpc/tasks/netconf.yaml @@ -3,6 +3,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_static_route/tasks/netconf.yaml b/test/integration/targets/junos_static_route/tasks/netconf.yaml index 92fc7092cd6..c1985c530ad 100644 --- a/test/integration/targets/junos_static_route/tasks/netconf.yaml +++ b/test/integration/targets/junos_static_route/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_system/tasks/netconf.yaml b/test/integration/targets/junos_system/tasks/netconf.yaml index 92fc7092cd6..c1985c530ad 100644 --- a/test/integration/targets/junos_system/tasks/netconf.yaml +++ b/test/integration/targets/junos_system/tasks/netconf.yaml @@ -4,7 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases - delegate_to: localhost + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_user/tasks/netconf.yaml b/test/integration/targets/junos_user/tasks/netconf.yaml index c66de84ca94..2c76b54d9f6 100644 --- a/test/integration/targets/junos_user/tasks/netconf.yaml +++ b/test/integration/targets/junos_user/tasks/netconf.yaml @@ -4,6 +4,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_vlan/tasks/netconf.yaml b/test/integration/targets/junos_vlan/tasks/netconf.yaml index 337b000896a..24181dcf382 100644 --- a/test/integration/targets/junos_vlan/tasks/netconf.yaml +++ b/test/integration/targets/junos_vlan/tasks/netconf.yaml @@ -3,6 +3,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" diff --git a/test/integration/targets/junos_vrf/tasks/netconf.yaml b/test/integration/targets/junos_vrf/tasks/netconf.yaml index 337b000896a..24181dcf382 100644 --- a/test/integration/targets/junos_vrf/tasks/netconf.yaml +++ b/test/integration/targets/junos_vrf/tasks/netconf.yaml @@ -3,6 +3,7 @@ paths: "{{ role_path }}/tests/netconf" patterns: "{{ testcase }}.yaml" register: test_cases + connection: local - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"