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...] ```
77 lines
2.5 KiB
YAML
77 lines
2.5 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_ssh_key_info
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count >= 1
|
|
|
|
- name: Gather hcloud_ssh_key_info in check mode
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
check_mode: true
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info in check mode
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count >= 1
|
|
|
|
- name: Gather hcloud_ssh_key_info with correct id
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
id: "{{ test_ssh_key.hcloud_ssh_key.id }}"
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with correct id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count == 1
|
|
|
|
- name: Gather hcloud_ssh_key_info with wrong id
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
id: "{{ test_ssh_key.hcloud_ssh_key.id }}4321"
|
|
ignore_errors: true
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with wrong id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result is failed
|
|
|
|
- name: Gather hcloud_ssh_key_info with correct name
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
name: "{{ hcloud_ssh_key_name }}"
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with correct name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count == 1
|
|
|
|
- name: Gather hcloud_ssh_key_info with wrong name
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
name: "{{ hcloud_ssh_key_name }}-invalid"
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with wrong name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count == 0
|
|
|
|
- name: Gather hcloud_ssh_key_info with correct label selector
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
label_selector: "key=value"
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with correct label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
- >
|
|
result.hcloud_ssh_key_info
|
|
| selectattr('name', 'equalto', '{{ hcloud_ssh_key_name }}')
|
|
| list | count == 1
|
|
|
|
- name: Gather hcloud_ssh_key_info with wrong label selector
|
|
hetzner.hcloud.hcloud_ssh_key_info:
|
|
label_selector: "key!=value"
|
|
register: result
|
|
- name: Verify hcloud_ssh_key_info with wrong label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_ssh_key_info | list | count == 0
|