From a330106b2e2c811db49477d71b8a472c964d2aeb Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Thu, 8 Aug 2019 12:29:41 -0700 Subject: fixed --- .../targets/vyos_system/defaults/main.yaml | 3 ++ .../integration/targets/vyos_system/tasks/cli.yaml | 22 ++++++++ .../targets/vyos_system/tasks/main.yaml | 2 + .../targets/vyos_system/tests/cli/basic.yaml | 61 ++++++++++++++++++++++ .../targets/vyos_system/tests/cli/net_system.yaml | 30 +++++++++++ .../vyos_system/vyos_system/defaults/main.yaml | 3 -- .../targets/vyos_system/vyos_system/tasks/cli.yaml | 22 -------- .../vyos_system/vyos_system/tasks/main.yaml | 2 - .../vyos_system/vyos_system/tests/cli/basic.yaml | 61 ---------------------- .../vyos_system/tests/cli/net_system.yaml | 30 ----------- 10 files changed, 118 insertions(+), 118 deletions(-) create mode 100644 test/integration/targets/vyos_system/defaults/main.yaml create mode 100644 test/integration/targets/vyos_system/tasks/cli.yaml create mode 100644 test/integration/targets/vyos_system/tasks/main.yaml create mode 100644 test/integration/targets/vyos_system/tests/cli/basic.yaml create mode 100644 test/integration/targets/vyos_system/tests/cli/net_system.yaml delete mode 100644 test/integration/targets/vyos_system/vyos_system/defaults/main.yaml delete mode 100644 test/integration/targets/vyos_system/vyos_system/tasks/cli.yaml delete mode 100644 test/integration/targets/vyos_system/vyos_system/tasks/main.yaml delete mode 100644 test/integration/targets/vyos_system/vyos_system/tests/cli/basic.yaml delete mode 100644 test/integration/targets/vyos_system/vyos_system/tests/cli/net_system.yaml (limited to 'test/integration/targets/vyos_system') diff --git a/test/integration/targets/vyos_system/defaults/main.yaml b/test/integration/targets/vyos_system/defaults/main.yaml new file mode 100644 index 00000000..9ef5ba51 --- /dev/null +++ b/test/integration/targets/vyos_system/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "*" +test_items: [] diff --git a/test/integration/targets/vyos_system/tasks/cli.yaml b/test/integration/targets/vyos_system/tasks/cli.yaml new file mode 100644 index 00000000..890d3acf --- /dev/null +++ b/test/integration/targets/vyos_system/tasks/cli.yaml @@ -0,0 +1,22 @@ +--- +- name: collect all cli test cases + find: + 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 }}" + +- name: run test case (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_system/tasks/main.yaml b/test/integration/targets/vyos_system/tasks/main.yaml new file mode 100644 index 00000000..415c99d8 --- /dev/null +++ b/test/integration/targets/vyos_system/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/vyos_system/tests/cli/basic.yaml b/test/integration/targets/vyos_system/tests/cli/basic.yaml new file mode 100644 index 00000000..474042fc --- /dev/null +++ b/test/integration/targets/vyos_system/tests/cli/basic.yaml @@ -0,0 +1,61 @@ +--- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + +- name: setup + vyos.vyos.vyos_config: + lines: + - delete system name-server 192.0.2.1 + - delete system name-server 192.0.2.2 + - delete system name-server 192.0.2.3 + match: none + +- name: configure name servers + vyos.vyos.vyos_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + register: result + +- assert: + that: + - result.changed == true + - result.commands|length == 3 + - result.commands[0] is search("set system name-server '192.0.2.1'") + - result.commands[1] is search("set system name-server '192.0.2.2'") + - result.commands[2] is search("set system name-server '192.0.2.3'") + +- name: verify name_servers + vyos.vyos.vyos_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + register: result + +- assert: + that: + - result.changed == false + +- name: remove one + vyos.vyos.vyos_system: + name_servers: + - 192.0.2.3 + state: absent + register: result + +- assert: + that: + - result.changed == true + - result.commands|length == 1 + - result.commands[0] is search("delete system name-server '192.0.2.3'") + +- name: teardown + vyos.vyos.vyos_config: + lines: + - delete system name-server name-server 192.0.2.1 + - delete system name-server name-server 192.0.2.2 + - delete system name-server name-server 192.0.2.3 + match: none + +- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_system/tests/cli/net_system.yaml b/test/integration/targets/vyos_system/tests/cli/net_system.yaml new file mode 100644 index 00000000..36888669 --- /dev/null +++ b/test/integration/targets/vyos_system/tests/cli/net_system.yaml @@ -0,0 +1,30 @@ +--- +- debug: msg="START vyos cli/net_system.yaml on connection={{ ansible_connection }}" + +# Add minimal testcase to check args are passed correctly to +# implementation module and module run is successful. + +- name: setup + vyos.vyos.vyos_config: + lines: + - delete system name-server 192.0.2.1 + match: none + +- name: configure name servers using platform agnostic module + net_system: + name_servers: + - 192.0.2.1 + register: result + +- assert: + that: + - result.changed == true + - result.commands[0] is search("set system name-server '192.0.2.1'") + +- name: setup + vyos.vyos.vyos_config: + lines: + - delete system name-server 192.0.2.1 + match: none + +- debug: msg="END vyos cli/net_system.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_system/vyos_system/defaults/main.yaml b/test/integration/targets/vyos_system/vyos_system/defaults/main.yaml deleted file mode 100644 index 9ef5ba51..00000000 --- a/test/integration/targets/vyos_system/vyos_system/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/vyos_system/vyos_system/tasks/cli.yaml b/test/integration/targets/vyos_system/vyos_system/tasks/cli.yaml deleted file mode 100644 index 890d3acf..00000000 --- a/test/integration/targets/vyos_system/vyos_system/tasks/cli.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: collect all cli test cases - find: - 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 }}" - -- name: run test case (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_system/vyos_system/tasks/main.yaml b/test/integration/targets/vyos_system/vyos_system/tasks/main.yaml deleted file mode 100644 index 415c99d8..00000000 --- a/test/integration/targets/vyos_system/vyos_system/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/vyos_system/vyos_system/tests/cli/basic.yaml b/test/integration/targets/vyos_system/vyos_system/tests/cli/basic.yaml deleted file mode 100644 index c42eddea..00000000 --- a/test/integration/targets/vyos_system/vyos_system/tests/cli/basic.yaml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: setup - vyos_config: - lines: - - delete system name-server 192.0.2.1 - - delete system name-server 192.0.2.2 - - delete system name-server 192.0.2.3 - match: none - -- name: configure name servers - vyos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 3 - - result.commands[0] is search("set system name-server '192.0.2.1'") - - result.commands[1] is search("set system name-server '192.0.2.2'") - - result.commands[2] is search("set system name-server '192.0.2.3'") - -- name: verify name_servers - vyos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - register: result - -- assert: - that: - - result.changed == false - -- name: remove one - vyos_system: - name_servers: - - 192.0.2.3 - state: absent - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 1 - - result.commands[0] is search("delete system name-server '192.0.2.3'") - -- name: teardown - vyos_config: - lines: - - delete system name-server name-server 192.0.2.1 - - delete system name-server name-server 192.0.2.2 - - delete system name-server name-server 192.0.2.3 - match: none - -- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_system/vyos_system/tests/cli/net_system.yaml b/test/integration/targets/vyos_system/vyos_system/tests/cli/net_system.yaml deleted file mode 100644 index b7813c09..00000000 --- a/test/integration/targets/vyos_system/vyos_system/tests/cli/net_system.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START vyos cli/net_system.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - vyos_config: - lines: - - delete system name-server 192.0.2.1 - match: none - -- name: configure name servers using platform agnostic module - net_system: - name_servers: - - 192.0.2.1 - register: result - -- assert: - that: - - result.changed == true - - result.commands[0] is search("set system name-server '192.0.2.1'") - -- name: setup - vyos_config: - lines: - - delete system name-server 192.0.2.1 - match: none - -- debug: msg="END vyos cli/net_system.yaml on connection={{ ansible_connection }}" -- cgit v1.2.3