mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
##### SUMMARY - Implement the new testing framework (prepare.yml/cleanup.yml #239) - Fix some uncovered test scenarios (related to #298). - Structure all the *_info tests using the following structure: ``` gather all [gather all with custom options...] gather all in check mode gather with id gather with name gather with labels [gather with custom option...] ```
81 lines
2.7 KiB
YAML
81 lines
2.7 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_volume_info
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
register: result
|
|
- name: Verify hcloud_volume_info
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count >= 1
|
|
|
|
- name: Gather hcloud_volume_info in check mode
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
check_mode: true
|
|
register: result
|
|
- name: Verify hcloud_volume_info in check mode
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count >= 1
|
|
|
|
- name: Gather hcloud_volume_info with correct id
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
id: "{{ test_volume.hcloud_volume.id }}"
|
|
register: result
|
|
- name: Verify hcloud_volume_info with correct id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count == 1
|
|
- result.hcloud_volume_info[0].name == '{{ hcloud_volume_name }}'
|
|
- result.hcloud_volume_info[0].location == 'fsn1'
|
|
- result.hcloud_volume_info[0].size == 10
|
|
- result.hcloud_volume_info[0].linux_device is defined
|
|
|
|
- name: Gather hcloud_volume_info with wrong id
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
id: "{{ test_volume.hcloud_volume.id }}4321"
|
|
ignore_errors: true
|
|
register: result
|
|
- name: Verify hcloud_volume_info with wrong id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result is failed
|
|
|
|
- name: Gather hcloud_volume_info with correct name
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
name: "{{ hcloud_volume_name }}"
|
|
register: result
|
|
- name: Verify hcloud_volume_info with correct name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count == 1
|
|
|
|
- name: Gather hcloud_volume_info with wrong name
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
name: "{{ hcloud_volume_name }}-invalid"
|
|
register: result
|
|
- name: Verify hcloud_volume_info with wrong name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count == 0
|
|
|
|
- name: Gather hcloud_volume_info with correct label selector
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
label_selector: "key=value"
|
|
register: result
|
|
- name: Verify hcloud_volume_info with correct label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
- >
|
|
result.hcloud_volume_info
|
|
| selectattr('name', 'equalto', '{{ hcloud_volume_name }}')
|
|
| list | count == 1
|
|
|
|
- name: Gather hcloud_volume_info with wrong label selector
|
|
hetzner.hcloud.hcloud_volume_info:
|
|
label_selector: "key!=value"
|
|
register: result
|
|
- name: Verify hcloud_volume_info with wrong label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_volume_info | list | count == 0
|