diff --git a/tests/integration/targets/firewall/tasks/test.yml b/tests/integration/targets/firewall/tasks/test.yml index 5705984..8179bc6 100644 --- a/tests/integration/targets/firewall/tasks/test.yml +++ b/tests/integration/targets/firewall/tasks/test.yml @@ -183,7 +183,7 @@ ansible.builtin.assert: that: - result is failed - - '"is still in use" in result.msg' + - result.failure.code == "resource_in_use" - name: Test delete with force hetzner.hcloud.firewall: diff --git a/tests/integration/targets/floating_ip/tasks/test.yml b/tests/integration/targets/floating_ip/tasks/test.yml index cf6330e..23f29b2 100644 --- a/tests/integration/targets/floating_ip/tasks/test.yml +++ b/tests/integration/targets/floating_ip/tasks/test.yml @@ -101,6 +101,7 @@ assert: that: - result is failed + - result.failure.code == "invalid_input" - result.msg == "invalid input in fields 'server', 'home_location'" - name: test create Floating IP with check mode @@ -371,7 +372,8 @@ assert: that: - result is failed - - 'result.msg == "Floating IP deletion is protected"' + - result.failure.code == "protected" + - result.msg == "Floating IP deletion is protected" - name: test update Floating IP delete protection hetzner.hcloud.floating_ip: @@ -459,7 +461,8 @@ assert: that: - result is failed - - 'result.msg == "Floating IP deletion is protected"' + - result.failure.code == "protected" + - result.msg == "Floating IP deletion is protected" - name: test update Floating IP delete protection hetzner.hcloud.floating_ip: diff --git a/tests/integration/targets/load_balancer/tasks/test.yml b/tests/integration/targets/load_balancer/tasks/test.yml index 343f156..3b7de5b 100644 --- a/tests/integration/targets/load_balancer/tasks/test.yml +++ b/tests/integration/targets/load_balancer/tasks/test.yml @@ -120,7 +120,8 @@ ansible.builtin.assert: that: - result is failed - - 'result.msg == "load balancer deletion is protected"' + - result.failure.code == "protected" + - result.msg == "load balancer deletion is protected" - name: Test update delete_protection hetzner.hcloud.load_balancer: diff --git a/tests/integration/targets/network/tasks/test.yml b/tests/integration/targets/network/tasks/test.yml index 5f26d1f..b814ceb 100644 --- a/tests/integration/targets/network/tasks/test.yml +++ b/tests/integration/targets/network/tasks/test.yml @@ -99,7 +99,8 @@ ansible.builtin.assert: that: - result is failed - - 'result.msg == "network deletion is protected"' + - result.failure.code == "protected" + - result.msg == "network deletion is protected" - name: Test update delete protection hetzner.hcloud.network: diff --git a/tests/integration/targets/primary_ip/tasks/test.yml b/tests/integration/targets/primary_ip/tasks/test.yml index 09e9790..84fd6a3 100644 --- a/tests/integration/targets/primary_ip/tasks/test.yml +++ b/tests/integration/targets/primary_ip/tasks/test.yml @@ -120,7 +120,8 @@ ansible.builtin.assert: that: - result is failed - - '"Primary IP deletion is protected" in result.msg' + - result.failure.code == "protected" + - result.msg == "Primary IP deletion is protected" - name: Test update delete protection hetzner.hcloud.primary_ip: diff --git a/tests/integration/targets/server/tasks/test_basic.yml b/tests/integration/targets/server/tasks/test_basic.yml index 1e94d67..879e2d6 100644 --- a/tests/integration/targets/server/tasks/test_basic.yml +++ b/tests/integration/targets/server/tasks/test_basic.yml @@ -315,7 +315,8 @@ assert: that: - result is failed - - 'result.msg == "server deletion is protected"' + - result.failure.code == "protected" + - result.msg == "server deletion is protected" - name: test rebuild server fails if it is protected hetzner.hcloud.server: @@ -328,7 +329,8 @@ assert: that: - result is failed - - 'result.msg == "server rebuild is protected"' + - result.failure.code == "protected" + - result.msg == "server rebuild is protected" - name: test remove server protection hetzner.hcloud.server: @@ -585,7 +587,8 @@ assert: that: - result is failed - - 'result.msg == "server deletion is protected"' + - result.failure.code == "protected" + - result.msg == "server deletion is protected" - name: remove protection from server hetzner.hcloud.server: diff --git a/tests/integration/targets/server/tasks/test_firewalls.yml b/tests/integration/targets/server/tasks/test_firewalls.yml index 896a6c5..230df46 100644 --- a/tests/integration/targets/server/tasks/test_firewalls.yml +++ b/tests/integration/targets/server/tasks/test_firewalls.yml @@ -13,7 +13,9 @@ assert: that: - result is failed - - 'result.msg == "firewall not-existing was not found"' + - result.failure.code == "not_found" + - result.msg == "firewall not-existing was not found" + - name: setup create firewalls hetzner.hcloud.firewall: name: "{{ item }}" diff --git a/tests/integration/targets/server/tasks/test_validation.yml b/tests/integration/targets/server/tasks/test_validation.yml index d4e0ef8..e051816 100644 --- a/tests/integration/targets/server/tasks/test_validation.yml +++ b/tests/integration/targets/server/tasks/test_validation.yml @@ -34,7 +34,8 @@ assert: that: - result is failed - - 'result.msg == "server_type not-existing-server-type was not found"' + - result.failure.code == "not_found" + - result.msg == "server_type not-existing-server-type was not found" - name: test create server with not existing image hetzner.hcloud.server: @@ -48,4 +49,5 @@ assert: that: - result is failed - - 'result.msg == "Image my-not-existing-image-20.04 was not found"' + - result.failure.code == "not_found" + - result.msg == "Image my-not-existing-image-20.04 was not found" diff --git a/tests/integration/targets/ssh_key/tasks/test.yml b/tests/integration/targets/ssh_key/tasks/test.yml index 41b9c35..e314266 100644 --- a/tests/integration/targets/ssh_key/tasks/test.yml +++ b/tests/integration/targets/ssh_key/tasks/test.yml @@ -133,7 +133,8 @@ assert: that: - result is failed - - 'result.msg == "SSH key with the same fingerprint already exists"' + - result.failure.code == "uniqueness_error" + - result.msg == "SSH key with the same fingerprint already exists" - name: test delete ssh key hetzner.hcloud.ssh_key: diff --git a/tests/integration/targets/volume/tasks/test.yml b/tests/integration/targets/volume/tasks/test.yml index 4163716..9b586e0 100644 --- a/tests/integration/targets/volume/tasks/test.yml +++ b/tests/integration/targets/volume/tasks/test.yml @@ -208,7 +208,8 @@ assert: that: - result is failed - - 'result.msg == "volume deletion is protected"' + - result.failure.code == "protected" + - result.msg == "volume deletion is protected" - name: test update Volume delete protection hetzner.hcloud.volume: @@ -254,7 +255,8 @@ assert: that: - result is failed - - 'result.msg == "volume deletion is protected"' + - result.failure.code == "protected" + - result.msg == "volume deletion is protected" - name: test update Volume delete protection hetzner.hcloud.volume: