mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
loadbalancer_: improve error handlings (#138)
* loadbalancer_: improve error handlings * streamline a bit to make ansible 2.9 pass * handle race condition
This commit is contained in:
parent
a0a5da3f46
commit
1d568f3ac7
6 changed files with 99 additions and 10 deletions
|
|
@ -26,6 +26,32 @@
|
|||
that:
|
||||
- load_balancer is success
|
||||
|
||||
- name: test fail load balancer does not exist
|
||||
hetzner.hcloud.hcloud_load_balancer_target:
|
||||
type: server
|
||||
load_balancer: does-not-exist
|
||||
server: "{{ hcloud_server_name }}"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
- name: verify test fail load_balancer does not exist
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "result.msg == 'Load balancer does not exist: does-not-exist'"
|
||||
|
||||
- name: test fail server does not exist
|
||||
hetzner.hcloud.hcloud_load_balancer_target:
|
||||
type: server
|
||||
load_balancer: "{{ hcloud_load_balancer_name }}"
|
||||
server: does-not-exist
|
||||
register: result
|
||||
ignore_errors: true
|
||||
- name: verify test fail server does not exist
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "result.msg == 'Server not found: does-not-exist'"
|
||||
|
||||
- name: test create load_balancer target with checkmode
|
||||
hcloud_load_balancer_target:
|
||||
type: "server"
|
||||
|
|
@ -113,10 +139,9 @@
|
|||
name: "{{ hcloud_load_balancer_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify cleanup load_balancer
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
until: result is not failed
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: cleanup
|
||||
hcloud_server:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue