diff options
author | CaptTrews <capttrews@gmail.com> | 2019-08-29 14:21:30 +0000 |
---|---|---|
committer | CaptTrews <capttrews@gmail.com> | 2019-08-29 14:21:30 +0000 |
commit | ae8514ce0289ee2096a3a9f54be6a4654153c880 (patch) | |
tree | 2d9a958c135c5ec4cad86650e8f7d7ef173d33c2 /tests/integration/targets/vyos_banner | |
parent | 59af486ab07108815ad1774205959fa8287d6e53 (diff) | |
download | vyos-ansible-old-ae8514ce0289ee2096a3a9f54be6a4654153c880.tar.gz vyos-ansible-old-ae8514ce0289ee2096a3a9f54be6a4654153c880.zip |
Updated from network content collector
Signed-off-by: CaptTrews <capttrews@gmail.com>
Diffstat (limited to 'tests/integration/targets/vyos_banner')
7 files changed, 163 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_banner/aliases b/tests/integration/targets/vyos_banner/aliases new file mode 100644 index 0000000..539d957 --- /dev/null +++ b/tests/integration/targets/vyos_banner/aliases @@ -0,0 +1 @@ +shippable/network diff --git a/tests/integration/targets/vyos_banner/defaults/main.yaml b/tests/integration/targets/vyos_banner/defaults/main.yaml new file mode 100644 index 0000000..9ef5ba5 --- /dev/null +++ b/tests/integration/targets/vyos_banner/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "*" +test_items: [] diff --git a/tests/integration/targets/vyos_banner/tasks/cli.yaml b/tests/integration/targets/vyos_banner/tasks/cli.yaml new file mode 100644 index 0000000..890d3ac --- /dev/null +++ b/tests/integration/targets/vyos_banner/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/tests/integration/targets/vyos_banner/tasks/main.yaml b/tests/integration/targets/vyos_banner/tasks/main.yaml new file mode 100644 index 0000000..415c99d --- /dev/null +++ b/tests/integration/targets/vyos_banner/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml new file mode 100644 index 0000000..5efdf8e --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml @@ -0,0 +1,41 @@ +--- +- debug: + msg: "cli/basic-no-login.yaml on connection={{ ansible_connection }}" + +- name: Setup + vyos.vyos.vyos_banner: + banner: pre-login + text: | + Junk pre-login banner + over multiple lines + state: present + +- name: remove pre-login + vyos.vyos.vyos_banner: + banner: pre-login + state: absent + register: result + +- debug: + msg: "{{ result }}" + +- assert: + that: + - "result.changed == true" + - "'delete system login banner pre-login' in result.commands" + +- name: remove pre-login (idempotent) + vyos.vyos.vyos_banner: + banner: pre-login + state: absent + register: result + +- assert: + that: + - "result.changed == false" + - "result.commands | length == 0" + + +# FIXME add in tests for everything defined in docs +# FIXME Test state:absent + test: +# FIXME Without powers ensure "privileged mode required" diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml new file mode 100644 index 0000000..ff6cbad --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml @@ -0,0 +1,47 @@ +--- +- debug: + msg: "cli/basic-post-login.yaml on connection={{ ansible_connection }}" + +- name: setup - remove post-login + vyos.vyos.vyos_banner: + banner: post-login + state: absent + +- name: Set post-login + vyos.vyos.vyos_banner: + banner: post-login + text: | + this is my post-login banner + that has a multiline + string + state: present + register: result + +- debug: + msg: "{{ result }}" + +- assert: + that: + - "result.changed == true" + - "'this is my post-login banner' in result.commands[0]" + - "'that has a multiline' in result.commands[0]" + +- name: Set post-login again (idempotent) + vyos.vyos.vyos_banner: + banner: post-login + text: | + this is my post-login banner + that has a multiline + string + state: present + register: result + +- assert: + that: + - "result.changed == false" + - "result.commands | length == 0" + + +# FIXME add in tests for everything defined in docs +# FIXME Test state:absent + test: +# FIXME Without powers ensure "privileged mode required" diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml new file mode 100644 index 0000000..8489d87 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml @@ -0,0 +1,47 @@ +--- +- debug: + msg: "cli/basic-pre-login.yaml on connection={{ ansible_connection }}" + +- name: setup - remove pre-login + vyos.vyos.vyos_banner: + banner: pre-login + state: absent + +- name: Set pre-login + vyos.vyos.vyos_banner: + banner: pre-login + text: | + this is my pre-login banner + that has a multiline + string + state: present + register: result + +- debug: + msg: "{{ result }}" + +- assert: + that: + - "result.changed == true" + - "'this is my pre-login banner' in result.commands[0]" + - "'that has a multiline' in result.commands[0]" + +- name: Set pre-login again (idempotent) + vyos.vyos.vyos_banner: + banner: pre-login + text: | + this is my pre-login banner + that has a multiline + string + state: present + register: result + +- assert: + that: + - "result.changed == false" + - "result.commands | length == 0" + + +# FIXME add in tests for everything defined in docs +# FIXME Test state:absent + test: +# FIXME Without powers ensure "privileged mode required" |