1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00
hetzner.hcloud/tests/integration/targets/floating_ip_info/tasks/test.yml
Jonas L 328dfb8b0f
refactor: start using new modules names (#393)
##### SUMMARY

Update all references to modules to use the new module names.
Continuation of #390
2023-11-21 09:40:11 +01:00

77 lines
2.6 KiB
YAML

# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: Gather hcloud_floating_ip_info
hetzner.hcloud.floating_ip_info:
register: result
- name: Verify hcloud_floating_ip_info
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count >= 1
- name: Gather hcloud_floating_ip_info in check mode
hetzner.hcloud.floating_ip_info:
check_mode: true
register: result
- name: Verify hcloud_floating_ip_info in check mode
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count >= 1
- name: Gather hcloud_floating_ip_info with correct id
hetzner.hcloud.floating_ip_info:
id: "{{ test_floating_ip.hcloud_floating_ip.id }}"
register: result
- name: Verify hcloud_floating_ip_info with correct id
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count == 1
- name: Gather hcloud_floating_ip_info with wrong id
hetzner.hcloud.floating_ip_info:
id: "{{ test_floating_ip.hcloud_floating_ip.id }}4321"
ignore_errors: true
register: result
- name: Verify hcloud_floating_ip_info with wrong id
ansible.builtin.assert:
that:
- result is failed
- name: Gather hcloud_floating_ip_info with correct name
hetzner.hcloud.floating_ip_info:
name: "{{ hcloud_floating_ip_name }}"
register: result
- name: Verify hcloud_floating_ip_info with correct name
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count == 1
- name: Gather hcloud_floating_ip_info with wrong name
hetzner.hcloud.floating_ip_info:
name: "{{ hcloud_floating_ip_name }}-invalid"
register: result
- name: Verify hcloud_floating_ip_info with wrong name
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count == 0
- name: Gather hcloud_floating_ip_info with correct label selector
hetzner.hcloud.floating_ip_info:
label_selector: "key=value"
register: result
- name: Verify hcloud_floating_ip_info with correct label selector
ansible.builtin.assert:
that:
- >
result.hcloud_floating_ip_info
| selectattr('name', 'equalto', '{{ hcloud_floating_ip_name }}')
| list | count == 1
- name: Gather hcloud_floating_ip_info with wrong label selector
hetzner.hcloud.floating_ip_info:
label_selector: "key!=value"
register: result
- name: Verify hcloud_floating_ip_info with wrong label selector
ansible.builtin.assert:
that:
- result.hcloud_floating_ip_info | list | count == 0