Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update consul integration test with http checks #12589

Merged
merged 1 commit into from
Oct 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 45 additions & 1 deletion test/integration/roles/test_consul_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
with_items:
- service1
- service2
- http_check
- with_check
- 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
consul:
service_name: service1
Expand Down Expand Up @@ -37,12 +46,28 @@
- basic2_result.service_id == 'service2'
- 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
consul:
service_name: with_check
service_port: 80
script: "sh -c true"
interval: 60
interval: 60s
register: script_result

- name: verify service with check registration
Expand Down Expand Up @@ -86,6 +111,25 @@
- nodelevel_result.script == 'sh -c true'
- 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
consul:
service_id: 'service1'
Expand Down