mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-11-10 06:34:13 +00:00
test: various fixes for integration tests (#193)
* test: update for new locations * test(cert): fix issues with random name failing the test The variable hcloud_dns_test_domain used the random function to generate a number from 1-100. This number changed between every usage of the variable, so the test that compared the domain name of the cert to the variable kept failing, as different numbers were generated. By generating the number once and saving it into a fact, this is fixed. * test: fix issues with long resource names Server and volume names have restricted length (63 and 64 respectivly). This can cause issues when the `hcloud_prefix` is of certain length. By applying truncate, we can be sure to not reach the limit. This issue mainly happened in our internal ci, as the hcloud_prefix variable contains the hostname where the tests were running, and our hostnames are quite long.
This commit is contained in:
parent
292cdf2a05
commit
e218306028
16 changed files with 28 additions and 22 deletions
|
@ -96,7 +96,7 @@
|
|||
key: value
|
||||
test: "val123"
|
||||
register: result
|
||||
- name: test update certificate with other labels
|
||||
- name: test update certificate with other labels
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
@ -122,6 +122,12 @@
|
|||
that:
|
||||
- result is success
|
||||
|
||||
- name: generate dns domain name
|
||||
set_fact:
|
||||
# hcloud_dns_test_domain uses random, which generates a new random number
|
||||
# on every invocation, by saving it into a fact we generate the number once
|
||||
hcloud_dns_test_domain: "{{ hcloud_dns_test_domain }}"
|
||||
|
||||
- name: test create managed certificate
|
||||
hcloud_certificate:
|
||||
name: "{{ hcloud_certificate_name }}"
|
||||
|
@ -131,7 +137,7 @@
|
|||
labels:
|
||||
HC-Use-Staging-CA: "true"
|
||||
register: result
|
||||
- name: test rename certificate
|
||||
- name: verify create managed certificate
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
@ -143,7 +149,7 @@
|
|||
id: "{{ result.hcloud_certificate.id }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify absent server
|
||||
- name: verify absent certificate
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
- name: verify test gather hcloud datacenter infos
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count == 4
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count >= 5
|
||||
|
||||
- name: test gather hcloud datacenter infos in check mode
|
||||
hcloud_datacenter_info:
|
||||
|
@ -18,7 +18,7 @@
|
|||
- name: verify test gather hcloud datacenter infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count == 4
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count >= 5
|
||||
|
||||
- name: test gather hcloud datacenter infos with correct name
|
||||
hcloud_datacenter_info:
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_floating_ip_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-fip-t"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-fip-t"
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_load_balancer_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-lb-i"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-lb-i"
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-lb-t"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-lb-t"
|
||||
hcloud_load_balancer_name: "{{hcloud_prefix}}-lb-target"
|
||||
hcloud_testing_ip: "176.9.59.39"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
- name: verify test gather hcloud location infos
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 3
|
||||
- hcloud_location.hcloud_location_info | list | count >= 5
|
||||
|
||||
- name: test gather hcloud location infos in check mode
|
||||
hcloud_location_info:
|
||||
|
@ -18,7 +18,7 @@
|
|||
- name: verify test gather hcloud location infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 3
|
||||
- hcloud_location.hcloud_location_info | list | count >= 5
|
||||
|
||||
- name: test gather hcloud location infos with correct name
|
||||
hcloud_location_info:
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_placement_group_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-i"
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
- name: test add server to placement group
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
placement_group: "{{ hcloud_server_name }}"
|
||||
placement_group: "{{ hcloud_placement_group_name }}"
|
||||
force: True
|
||||
state: present
|
||||
register: result
|
||||
|
@ -106,7 +106,7 @@
|
|||
- name: test add server to placement group idempotence
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
placement_group: "{{ hcloud_server_name }}"
|
||||
placement_group: "{{ hcloud_placement_group_name }}"
|
||||
force: True
|
||||
state: present
|
||||
register: result
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_primary_ip_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-fip-t"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-fip-t"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_server_name: "{{hcloud_prefix}}"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}"
|
||||
hcloud_floating_ip_name: "{{hcloud_prefix}}"
|
||||
hcloud_primary_ip_name: "{{hcloud_prefix}}"
|
||||
hcloud_load_balancer_name: "{{hcloud_prefix}}"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-i"
|
||||
hcloud_firewall_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_primary_ip_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_network_name: "{{hcloud_prefix}}-i"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-ii"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-ii"
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_network_name: "{{hcloud_prefix}}-sn"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-sn"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-sn"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_server_name: "{{hcloud_prefix}}"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}"
|
||||
hcloud_ssh_key_name: "{{hcloud_prefix}}"
|
||||
hcloud_ssh_key_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnaTPfKaX1QKcRLOfr34buVLh5FhJAThI9NYB0xNdXsMd4Y0zLyyCQzHbx4eWCVZxym/s6csWSeLaAhO1GOHeAw3hQFMqf1oTBx6Y8g0pKpeotKPa/PDSUzdZF9Lc+DadtpQd8kFVHAu1Kd3zoEUnk1u6kP7I4qu4Z/6F9qBDF+M3aobiPVxdS7GwaVRW3nZu+FcQDLiBiNOjuRDyjHcDfEUkoh2SOu25RrFtGPzFu5mGmBJwotKpWAocLGfHzyn/fAHxgw3jKZVH/t+XWQFnl82Ie8yE3Z1EZ7oDkNRqFQT9AdXEQOLycTTYTQMJZpgeFTv3sAo6lPRCusiFmmLcf ci@ansible.hetzner.cloud"
|
||||
hcloud_ssh_key_fingerprint: "56:89:c4:d6:a7:4a:79:82:f4:c2:58:9c:e1:d2:2d:4e"
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_volume_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_server_name: "{{hcloud_prefix}}-vs"
|
||||
hcloud_volume_name: "{{ hcloud_prefix | truncate(60, True, '', 0) }}-i"
|
||||
hcloud_server_name: "{{ hcloud_prefix | truncate(45, True, '', 0) }}-vs"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
hcloud_prefix: "tests"
|
||||
hcloud_volume_name: "{{hcloud_prefix}}-i"
|
||||
hcloud_volume_name: "{{ hcloud_prefix | truncate(60, True, '', 0) }}-i"
|
||||
|
|
Loading…
Reference in a new issue