mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update consul integration test with http checks
This commit is contained in:
parent
86100da3a0
commit
9f9f476b6e
1 changed files with 45 additions and 1 deletions
|
@ -5,9 +5,18 @@
|
||||||
with_items:
|
with_items:
|
||||||
- service1
|
- service1
|
||||||
- service2
|
- service2
|
||||||
|
- http_check
|
||||||
- with_check
|
- with_check
|
||||||
- with_tags
|
- with_tags
|
||||||
|
|
||||||
|
- name: cleanup previous checks
|
||||||
|
consul:
|
||||||
|
check_id: '{{item}}'
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- node_level
|
||||||
|
- node_level_http
|
||||||
|
|
||||||
- name: register very basic service with consul gets default id
|
- name: register very basic service with consul gets default id
|
||||||
consul:
|
consul:
|
||||||
service_name: service1
|
service_name: service1
|
||||||
|
@ -37,12 +46,28 @@
|
||||||
- basic2_result.service_id == 'service2'
|
- basic2_result.service_id == 'service2'
|
||||||
- basic2_result.service_name == 'Basic Service'
|
- basic2_result.service_name == 'Basic Service'
|
||||||
|
|
||||||
|
- name: register a service with an http check
|
||||||
|
consul:
|
||||||
|
service_name: http_check
|
||||||
|
service_id: http_check
|
||||||
|
service_port: 80
|
||||||
|
http: "http://localhost/status"
|
||||||
|
interval: 60s
|
||||||
|
register: http_result
|
||||||
|
|
||||||
|
- name: verify service with an http check
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- http_result.changed
|
||||||
|
- http_result.service_port == 80
|
||||||
|
- http_result.checks | length == 1
|
||||||
|
|
||||||
- name: register very basic service with check script
|
- name: register very basic service with check script
|
||||||
consul:
|
consul:
|
||||||
service_name: with_check
|
service_name: with_check
|
||||||
service_port: 80
|
service_port: 80
|
||||||
script: "sh -c true"
|
script: "sh -c true"
|
||||||
interval: 60
|
interval: 60s
|
||||||
register: script_result
|
register: script_result
|
||||||
|
|
||||||
- name: verify service with check registration
|
- name: verify service with check registration
|
||||||
|
@ -86,6 +111,25 @@
|
||||||
- nodelevel_result.script == 'sh -c true'
|
- nodelevel_result.script == 'sh -c true'
|
||||||
- nodelevel_result.interval == '50m'
|
- nodelevel_result.interval == '50m'
|
||||||
|
|
||||||
|
- name: create a node level http check
|
||||||
|
consul:
|
||||||
|
check_name: Node Level HTTP Check
|
||||||
|
check_id: node_level_http
|
||||||
|
http: 'http://localhost/status'
|
||||||
|
interval: 1m
|
||||||
|
timeout: 30s
|
||||||
|
register: nodelevel_http_result
|
||||||
|
|
||||||
|
- name: verify node level http check
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- nodelevel_http_result.changed
|
||||||
|
- nodelevel_http_result.check_name == 'Node Level HTTP Check'
|
||||||
|
- nodelevel_http_result.check_id == 'node_level_http'
|
||||||
|
- nodelevel_http_result.http == 'http://localhost/status'
|
||||||
|
- nodelevel_http_result.interval == '1m'
|
||||||
|
- nodelevel_http_result.timeout == '30s'
|
||||||
|
|
||||||
- name: remove a service
|
- name: remove a service
|
||||||
consul:
|
consul:
|
||||||
service_id: 'service1'
|
service_id: 'service1'
|
||||||
|
|
Loading…
Reference in a new issue