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/hcloud_image_info/tasks/main.yml
Julian Tölle 3c2d4df8bb
feat: add support for ARM APIs (#208)
* feat: add architecture fields for image & server type

* feat: filter images by architecture

* feat: select right image by arch on server create & rebuild

* feat(inventory): add architecture field to returned servers

* docs: add changelog for arm features

* chore: prepare v1.11.0
2023-04-12 10:43:19 +02:00

93 lines
3.1 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: test gather hcloud image infos with type system
hcloud_image_info:
register: hcloud_images
- name: verify test gather hcloud image infos in check mode
assert:
that:
- hcloud_images.hcloud_image_info| list | count > 2
- name: test gather hcloud image infos in check mode
hcloud_image_info:
check_mode: yes
register: hcloud_images
- name: verify test gather hcloud image infos in check mode
assert:
that:
- hcloud_images.hcloud_image_info| list | count > 2
- name: test gather hcloud image infos with correct label selector
hcloud_image_info:
label_selector: "key=value"
type: snapshot
register: hcloud_images
- name: verify test gather hcloud image with correct label selector
assert:
that:
- hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
- name: test gather hcloud image infos with wrong label selector
hcloud_image_info:
label_selector: "key!=value"
type: snapshot
register: hcloud_images
- name: verify test gather hcloud image with wrong label selector
assert:
that:
- hcloud_images.hcloud_image_info | list | count == 0
- name: test gather hcloud image infos with correct id
hcloud_image_info:
id: "{{hcloud_test_image_id}}"
type: snapshot
register: hcloud_images
- name: verify test gather hcloud image with correct id
assert:
that:
- hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
- name: test gather hcloud image infos with wrong id
hcloud_image_info:
id: "{{hcloud_test_image_id}}1"
type: snapshot
ignore_errors: yes
register: result
- name: verify test gather hcloud image with wrong id
assert:
that:
- result is failed
- name: test gather hcloud image infos with name
hcloud_image_info:
name: "{{ hcloud_test_image_name_os }}"
register: hcloud_images
- name: verify test gather hcloud image infos with name
assert:
that:
- hcloud_images.hcloud_image_info | list | count == 1
- hcloud_images.hcloud_image_info[0].architecture == "x86"
- name: test gather hcloud image infos with name and architecture
hcloud_image_info:
name: "{{ hcloud_test_image_name_os }}"
architecture: arm
register: hcloud_images
- name: verify test gather hcloud image infos with name
assert:
that:
- hcloud_images.hcloud_image_info | list | count == 1
- hcloud_images.hcloud_image_info[0].architecture == "arm"
- name: test gather hcloud image infos with architecture
hcloud_image_info:
architecture: arm
register: hcloud_images
- name: verify test gather hcloud image infos with name
assert:
that:
- hcloud_images.hcloud_image_info | selectattr('architecture','equalto','x86') | list | count == 0
- hcloud_images.hcloud_image_info | selectattr('architecture','equalto','arm') | list | count > 2