diff options
Diffstat (limited to 'test/integration/targets/sensu_handler')
7 files changed, 0 insertions, 342 deletions
diff --git a/test/integration/targets/sensu_handler/aliases b/test/integration/targets/sensu_handler/aliases deleted file mode 100644 index 5dcaaac61c..0000000000 --- a/test/integration/targets/sensu_handler/aliases +++ /dev/null @@ -1,2 +0,0 @@ -shippable/posix/group1 -needs/root diff --git a/test/integration/targets/sensu_handler/tasks/main.yml b/test/integration/targets/sensu_handler/tasks/main.yml deleted file mode 100644 index 0c0b56d23e..0000000000 --- a/test/integration/targets/sensu_handler/tasks/main.yml +++ /dev/null @@ -1,119 +0,0 @@ -- name: Creating a handler if the directory doesn't exist should work - sensu_handler: - name: "handler" - type: "pipe" - command: "/bin/bash" - state: "present" - -- name: Insert junk JSON in a handlers file - lineinfile: - state: "present" - create: "yes" - path: "/etc/sensu/conf.d/handlers/handler.json" - line: "{'foo' = bar}" - -- name: Configure a handler with an existing invalid file - sensu_handler: - name: "handler" - type: "pipe" - command: "/bin/bash" - state: "present" - register: handler - -- name: Configure a handler (again) - sensu_handler: - name: "handler" - type: "pipe" - command: "/bin/bash" - state: "present" - register: handler_twice - -- name: Retrieve configuration file - slurp: - src: "{{ handler['file'] }}" - register: handler_config - -- name: Assert that handler data was set successfully and properly - assert: - that: - - "handler is successful" - - "handler is changed" - - "handler_twice is successful" - - "handler_twice is not changed" - - "handler['name'] == 'handler'" - - "handler['file'] == '/etc/sensu/conf.d/handlers/handler.json'" - - "handler['config']['type'] == 'pipe'" - - "handler['config']['command'] == '/bin/bash'" - - "handler['config']['timeout'] == 10" - - "handler['config']['handle_flapping'] == false" - - "handler['config']['handle_silenced'] == false" - -- name: Assert that the handler configuration file is actually configured properly - vars: - config: "{{ handler_config.content | b64decode | from_json }}" - assert: - that: - - "'handler' in config['handlers']" - - "config['handlers']['handler']['type'] == 'pipe'" - - "config['handlers']['handler']['command'] == '/bin/bash'" - - "config['handlers']['handler']['timeout'] == 10" - - "config['handlers']['handler']['handle_flapping'] == false" - - "config['handlers']['handler']['handle_silenced'] == false" - -- name: Delete Sensu handler configuration - sensu_handler: - name: "handler" - state: "absent" - register: handler_delete - -- name: Delete Sensu handler configuration (again) - sensu_handler: - name: "handler" - state: "absent" - register: handler_delete_twice - -- name: Retrieve configuration file stat - stat: - path: "{{ handler['file'] }}" - register: handler_stat - -- name: Assert that handler deletion was successful - assert: - that: - - "handler_delete is successful" - - "handler_delete is changed" - - "handler_delete_twice is successful" - - "handler_delete_twice is not changed" - - "handler_stat.stat.exists == false" - -- name: Configuring a handler without a name should fail - sensu_handler: - type: "pipe" - command: "/bin/bash" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler without a name fails - assert: - that: - - failure is failed - - "'required arguments: name' in failure['msg']" - -- name: Configuring a handler without a type should fail - sensu_handler: - name: "pipe" - command: "/bin/bash" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler without a type fails - assert: - that: - - failure is failed - - "'the following are missing: type' in failure['msg']" - -- include: pipe.yml -- include: tcp.yml -- include: udp.yml -- include: set.yml -- include: transport.yml diff --git a/test/integration/targets/sensu_handler/tasks/pipe.yml b/test/integration/targets/sensu_handler/tasks/pipe.yml deleted file mode 100644 index 02f59a4cd1..0000000000 --- a/test/integration/targets/sensu_handler/tasks/pipe.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Note: Pipe handlers are also tested and used as part of basic main.yml coverage -- name: Configuring a handler with missing pipe parameters should fail - sensu_handler: - name: "pipe" - type: "pipe" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler with missing pipe parameters fails - assert: - that: - - failure is failed - - "'the following are missing: command' in failure['msg']" - -- name: Configure a handler with pipe parameters - sensu_handler: - name: "pipe" - type: "pipe" - command: "/bin/bash" - register: handler diff --git a/test/integration/targets/sensu_handler/tasks/set.yml b/test/integration/targets/sensu_handler/tasks/set.yml deleted file mode 100644 index 393d711dc3..0000000000 --- a/test/integration/targets/sensu_handler/tasks/set.yml +++ /dev/null @@ -1,48 +0,0 @@ -- name: Configuring a handler with missing set parameters should fail - sensu_handler: - name: "set" - type: "set" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler with missing set parameters fails - assert: - that: - - failure is failed - - "'the following are missing: handlers' in failure['msg']" - -- name: Configure a set handler - sensu_handler: - name: "set" - type: "set" - handlers: - - anotherhandler - register: handler - -- name: Retrieve configuration file - slurp: - src: "{{ handler['file'] }}" - register: handler_config - -- name: Validate set handler return data - assert: - that: - - "handler is successful" - - "handler is changed" - - "handler['name'] == 'set'" - - "handler['file'] == '/etc/sensu/conf.d/handlers/set.json'" - - "handler['config']['type'] == 'set'" - - "'anotherhandler' in handler['config']['handlers']" - - "handler['config']['handle_flapping'] == false" - - "handler['config']['handle_silenced'] == false" - -- name: Assert that the handler configuration file is actually configured properly - vars: - config: "{{ handler_config.content | b64decode | from_json }}" - assert: - that: - - "'set' in config['handlers']" - - "config['handlers']['set']['type'] == 'set'" - - "'anotherhandler' in config['handlers']['set']['handlers']" - - "config['handlers']['set']['handle_flapping'] == false" - - "config['handlers']['set']['handle_silenced'] == false" diff --git a/test/integration/targets/sensu_handler/tasks/tcp.yml b/test/integration/targets/sensu_handler/tasks/tcp.yml deleted file mode 100644 index 076ea14e1e..0000000000 --- a/test/integration/targets/sensu_handler/tasks/tcp.yml +++ /dev/null @@ -1,51 +0,0 @@ -- name: Configuring a handler with missing tcp parameters should fail - sensu_handler: - name: "tcp" - type: "tcp" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler with missing tcp parameters fails - assert: - that: - - failure is failed - - "'the following are missing: socket' in failure['msg']" - -- name: Configure a tcp handler - sensu_handler: - name: "tcp" - type: "tcp" - socket: - host: 127.0.0.1 - port: 8000 - register: handler - -- name: Retrieve configuration file - slurp: - src: "{{ handler['file'] }}" - register: handler_config - -- name: Validate tcp handler return data - assert: - that: - - "handler is successful" - - "handler is changed" - - "handler['name'] == 'tcp'" - - "handler['file'] == '/etc/sensu/conf.d/handlers/tcp.json'" - - "handler['config']['type'] == 'tcp'" - - "handler['config']['socket']['host'] == '127.0.0.1'" - - "handler['config']['socket']['port'] == 8000" - - "handler['config']['handle_flapping'] == false" - - "handler['config']['handle_silenced'] == false" - -- name: Assert that the handler configuration file is actually configured properly - vars: - config: "{{ handler_config.content | b64decode | from_json }}" - assert: - that: - - "'tcp' in config['handlers']" - - "config['handlers']['tcp']['type'] == 'tcp'" - - "config['handlers']['tcp']['socket']['host'] == '127.0.0.1'" - - "config['handlers']['tcp']['socket']['port'] == 8000" - - "config['handlers']['tcp']['handle_flapping'] == false" - - "config['handlers']['tcp']['handle_silenced'] == false" diff --git a/test/integration/targets/sensu_handler/tasks/transport.yml b/test/integration/targets/sensu_handler/tasks/transport.yml deleted file mode 100644 index 34816194fa..0000000000 --- a/test/integration/targets/sensu_handler/tasks/transport.yml +++ /dev/null @@ -1,51 +0,0 @@ -- name: Configuring a handler with missing transport parameters should fail - sensu_handler: - name: "transport" - type: "transport" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler with missing transport parameters fails - assert: - that: - - failure is failed - - "'the following are missing: pipe' in failure['msg']" - -- name: Configure a transport handler - sensu_handler: - name: "transport" - type: "transport" - pipe: - type: "topic" - name: "transport_handler" - register: handler - -- name: Retrieve configuration file - slurp: - src: "{{ handler['file'] }}" - register: handler_config - -- name: Validate transport handler return data - assert: - that: - - "handler is successful" - - "handler is changed" - - "handler['name'] == 'transport'" - - "handler['file'] == '/etc/sensu/conf.d/handlers/transport.json'" - - "handler['config']['type'] == 'transport'" - - "handler['config']['pipe']['type'] == 'topic'" - - "handler['config']['pipe']['name'] == 'transport_handler'" - - "handler['config']['handle_flapping'] == false" - - "handler['config']['handle_silenced'] == false" - -- name: Assert that the handler configuration file is actually configured properly - vars: - config: "{{ handler_config.content | b64decode | from_json }}" - assert: - that: - - "'transport' in config['handlers']" - - "config['handlers']['transport']['type'] == 'transport'" - - "config['handlers']['transport']['pipe']['type'] == 'topic'" - - "config['handlers']['transport']['pipe']['name'] == 'transport_handler'" - - "config['handlers']['transport']['handle_flapping'] == false" - - "config['handlers']['transport']['handle_silenced'] == false" diff --git a/test/integration/targets/sensu_handler/tasks/udp.yml b/test/integration/targets/sensu_handler/tasks/udp.yml deleted file mode 100644 index 8f13a2a25e..0000000000 --- a/test/integration/targets/sensu_handler/tasks/udp.yml +++ /dev/null @@ -1,51 +0,0 @@ -- name: Configuring a handler with missing udp parameters should fail - sensu_handler: - name: "udp" - type: "udp" - register: failure - ignore_errors: true - -- name: Assert that configuring a handler with missing udp parameters fails - assert: - that: - - failure is failed - - "'the following are missing: socket' in failure['msg']" - -- name: Configure a udp handler - sensu_handler: - name: "udp" - type: "udp" - socket: - host: 127.0.0.1 - port: 8000 - register: handler - -- name: Retrieve configuration file - slurp: - src: "{{ handler['file'] }}" - register: handler_config - -- name: Validate udp handler return data - assert: - that: - - "handler is successful" - - "handler is changed" - - "handler['name'] == 'udp'" - - "handler['file'] == '/etc/sensu/conf.d/handlers/udp.json'" - - "handler['config']['type'] == 'udp'" - - "handler['config']['socket']['host'] == '127.0.0.1'" - - "handler['config']['socket']['port'] == 8000" - - "handler['config']['handle_flapping'] == false" - - "handler['config']['handle_silenced'] == false" - -- name: Assert that the handler configuration file is actually configured properly - vars: - config: "{{ handler_config.content | b64decode | from_json }}" - assert: - that: - - "'udp' in config['handlers']" - - "config['handlers']['udp']['type'] == 'udp'" - - "config['handlers']['udp']['socket']['host'] == '127.0.0.1'" - - "config['handlers']['udp']['socket']['port'] == 8000" - - "config['handlers']['udp']['handle_flapping'] == false" - - "config['handlers']['udp']['handle_silenced'] == false" |