mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-12-04 17:49:16 +00:00
test: use shared network zone variable (#543)
##### SUMMARY Allow to easily update the network zone when changing the location, for testing.
This commit is contained in:
parent
c6d7121e9e
commit
87ad95a0ad
43 changed files with 90 additions and 21 deletions
|
@ -22,3 +22,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
hetzner.hcloud.load_balancer:
|
||||
name: "{{ hcloud_load_balancer_name }}"
|
||||
load_balancer_type: lb11
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
state: present
|
||||
check_mode: true
|
||||
register: result
|
||||
|
@ -30,7 +30,7 @@
|
|||
hetzner.hcloud.load_balancer:
|
||||
name: "{{ hcloud_load_balancer_name }}"
|
||||
load_balancer_type: lb11
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
labels:
|
||||
key: value
|
||||
label: value123
|
||||
|
@ -51,7 +51,7 @@
|
|||
hetzner.hcloud.load_balancer:
|
||||
name: "{{ hcloud_load_balancer_name }}"
|
||||
load_balancer_type: lb11
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: Verify create idempotency
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
hetzner.hcloud.load_balancer:
|
||||
name: "{{ hcloud_load_balancer_name }}"
|
||||
load_balancer_type: lb11
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
labels:
|
||||
key: value
|
||||
register: test_load_balancer
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
network: "{{ hcloud_network_name }}"
|
||||
ip_range: "10.0.0.0/16"
|
||||
type: "cloud"
|
||||
network_zone: "eu-central"
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
state: present
|
||||
register: subnetwork
|
||||
- name: verify subnetwork
|
||||
|
@ -162,7 +162,7 @@
|
|||
network: "{{ hcloud_network_name }}"
|
||||
ip_range: "10.0.0.0/16"
|
||||
type: "cloud"
|
||||
network_zone: "eu-central"
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify cleanup subnetwork
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
type: server
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
ip_range: 10.0.1.0/24
|
||||
register: test_subnetwork
|
||||
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
hetzner.hcloud.load_balancer:
|
||||
name: "{{ hcloud_load_balancer_name }}"
|
||||
load_balancer_type: lb11
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
state: present
|
||||
register: test_load_balancer
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -468,6 +468,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is success
|
||||
|
||||
- name: test create server with labels
|
||||
hetzner.hcloud.server:
|
||||
name: "{{ hcloud_server_name}}"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}-1"
|
||||
ip_range: 192.168.0.0/24
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
state: present
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}-1"
|
||||
ip_range: 192.168.1.0/24
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
state: present
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}-2"
|
||||
ip_range: 192.168.2.0/24
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
state: present
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}-2"
|
||||
ip_range: 192.168.3.0/24
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
state: present
|
||||
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
type: server
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
ip_range: 10.0.1.0/24
|
||||
register: test_subnetwork
|
||||
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
- name: Test create with checkmode
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
ip_range: 10.0.0.0/24
|
||||
state: present
|
||||
|
@ -30,7 +30,7 @@
|
|||
- name: Test create
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
ip_range: 10.0.0.0/24
|
||||
state: present
|
||||
|
@ -40,14 +40,14 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.hcloud_subnetwork.network == hcloud_network_name
|
||||
- result.hcloud_subnetwork.network_zone == "eu-central"
|
||||
- result.hcloud_subnetwork.network_zone == hcloud_network_zone_name
|
||||
- result.hcloud_subnetwork.type == "cloud"
|
||||
- result.hcloud_subnetwork.ip_range == "10.0.0.0/24"
|
||||
|
||||
- name: Test create idempotency
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
ip_range: 10.0.0.0/24
|
||||
state: present
|
||||
|
@ -60,7 +60,7 @@
|
|||
- name: Test delete
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: cloud
|
||||
ip_range: 10.0.0.0/24
|
||||
state: absent
|
||||
|
@ -73,7 +73,7 @@
|
|||
- name: Test create with vswitch
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: vswitch
|
||||
ip_range: 10.0.1.0/24
|
||||
vswitch_id: "{{ test_vswitch_id }}"
|
||||
|
@ -84,7 +84,7 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.hcloud_subnetwork.network == hcloud_network_name
|
||||
- result.hcloud_subnetwork.network_zone == "eu-central"
|
||||
- result.hcloud_subnetwork.network_zone == hcloud_network_zone_name
|
||||
- result.hcloud_subnetwork.type == "vswitch"
|
||||
- result.hcloud_subnetwork.ip_range == "10.0.1.0/24"
|
||||
- result.hcloud_subnetwork.vswitch_id | string == test_vswitch_id
|
||||
|
@ -92,7 +92,7 @@
|
|||
- name: Test delete with vswitch
|
||||
hetzner.hcloud.subnetwork:
|
||||
network: "{{ hcloud_network_name }}"
|
||||
network_zone: eu-central
|
||||
network_zone: "{{ hcloud_network_zone_name }}"
|
||||
type: vswitch
|
||||
ip_range: 10.0.1.0/24
|
||||
state: absent
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
|
@ -25,3 +25,5 @@ hcloud_location_name: hel1
|
|||
hcloud_location_id: 3
|
||||
hcloud_datacenter_name: hel1-dc2
|
||||
hcloud_datacenter_id: 3
|
||||
|
||||
hcloud_network_zone_name: eu-central
|
||||
|
|
Loading…
Reference in a new issue