blob: 503d5b7870458255392e3d53a9877cd0731e1f27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# 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
|