diff options
author | Trishna Guha <trishnaguha17@gmail.com> | 2017-07-25 18:16:04 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-25 18:16:04 +0530 |
commit | 703eea3da22c9671d73c62d305e806fae8bc877d (patch) | |
tree | 96653c8eb29f33c887336643f52bff2e87f01a10 /test/integration/targets/eos_logging | |
parent | 12766571e976e8ff9d39bed6d92862175a2ba613 (diff) | |
download | ansible-703eea3da22c9671d73c62d305e806fae8bc877d.tar.gz |
eos_logging implementation module (#27093)
* eos_logging implementation module
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* eos_logging integration test
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* modify aggregate args logic
* changed collection to aggregate
* add blankline
* handle size value outside method
Diffstat (limited to 'test/integration/targets/eos_logging')
7 files changed, 241 insertions, 0 deletions
diff --git a/test/integration/targets/eos_logging/defaults/main.yaml b/test/integration/targets/eos_logging/defaults/main.yaml new file mode 100644 index 0000000000..5f709c5aac --- /dev/null +++ b/test/integration/targets/eos_logging/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/eos_logging/meta/main.yaml b/test/integration/targets/eos_logging/meta/main.yaml new file mode 100644 index 0000000000..e5c8cd02f0 --- /dev/null +++ b/test/integration/targets/eos_logging/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - prepare_eos_tests diff --git a/test/integration/targets/eos_logging/tasks/cli.yaml b/test/integration/targets/eos_logging/tasks/cli.yaml new file mode 100644 index 0000000000..d675462dd0 --- /dev/null +++ b/test/integration/targets/eos_logging/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/test/integration/targets/eos_logging/tasks/eapi.yaml b/test/integration/targets/eos_logging/tasks/eapi.yaml new file mode 100644 index 0000000000..00a159a98e --- /dev/null +++ b/test/integration/targets/eos_logging/tasks/eapi.yaml @@ -0,0 +1,28 @@ +--- +- name: collect all eapi test cases + find: + paths: "{{ role_path }}/tests/eapi" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: enable eapi + eos_eapi: + http: yes + https: yes + local_http: no + enable_socket: yes + provider: "{{ cli }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + +- name: disable eapi + eos_eapi: + state: stopped + provider: "{{ cli }}" diff --git a/test/integration/targets/eos_logging/tasks/main.yaml b/test/integration/targets/eos_logging/tasks/main.yaml new file mode 100644 index 0000000000..415c99d8b1 --- /dev/null +++ b/test/integration/targets/eos_logging/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_logging/tests/cli/basic.yaml b/test/integration/targets/eos_logging/tests/cli/basic.yaml new file mode 100644 index 0000000000..8a0b7fa156 --- /dev/null +++ b/test/integration/targets/eos_logging/tests/cli/basic.yaml @@ -0,0 +1,96 @@ +--- +- name: Set up host logging + eos_logging: + dest: host + name: 172.16.0.1 + state: present + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging host 172.16.0.1" in result.commands' + +- name: Set up host logging again (idempotent) + eos_logging: + dest: host + name: 172.16.0.1 + state: present + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == false' + +- name: Delete/disable host logging + eos_logging: + dest: host + name: 172.16.0.1 + state: absent + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"no logging host 172.16.0.1" in result.commands' + +- name: Delete/disable host logging (idempotent) + eos_logging: + dest: host + name: 172.16.0.1 + state: absent + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == false' + +- name: Console logging with level warnings + eos_logging: + dest: console + level: warnings + state: present + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging console warnings" in result.commands' + +- name: Configure buffer size + eos_logging: + dest: buffered + size: 480000 + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging buffered 480000" in result.commands' + +- name: remove logging as collection tearDown + eos_logging: + aggregate: + - { dest: console, level: warnings, state: absent } + - { dest: buffered, size: 480000, state: absent } + authorize: yes + provider: "{{ cli }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"no logging console" in result.commands' + - '"no logging buffered" in result.commands' diff --git a/test/integration/targets/eos_logging/tests/eapi/basic.yaml b/test/integration/targets/eos_logging/tests/eapi/basic.yaml new file mode 100644 index 0000000000..33252b45f4 --- /dev/null +++ b/test/integration/targets/eos_logging/tests/eapi/basic.yaml @@ -0,0 +1,96 @@ +--- +- name: Set up host logging + eos_logging: + dest: host + name: 172.16.0.1 + state: present + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging host 172.16.0.1" in result.commands' + +- name: Set up host logging again (idempotent) + eos_logging: + dest: host + name: 172.16.0.1 + state: present + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == false' + +- name: Delete/disable host logging + eos_logging: + dest: host + name: 172.16.0.1 + state: absent + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"no logging host 172.16.0.1" in result.commands' + +- name: Delete/disable host logging (idempotent) + eos_logging: + dest: host + name: 172.16.0.1 + state: absent + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == false' + +- name: Console logging with level warnings + eos_logging: + dest: console + level: warnings + state: present + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging console warnings" in result.commands' + +- name: Configure buffer size + eos_logging: + dest: buffered + size: 480000 + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"logging buffered 480000" in result.commands' + +- name: remove logging as collection tearDown + eos_logging: + aggregate: + - { dest: console, level: warnings, state: absent } + - { dest: buffered, size: 480000, state: absent } + authorize: yes + provider: "{{ eapi }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"no logging console" in result.commands' + - '"no logging buffered" in result.commands' |