Skip to content

Commit

Permalink
test: improve rdns integration using the testing framework (#372)
Browse files Browse the repository at this point in the history
##### SUMMARY

Use the new testing framework for the rdns integration tests.
  • Loading branch information
jooola authored Oct 23, 2023
1 parent 41ea82c commit c336f47
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 182 deletions.
1 change: 0 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exclude_paths:
- tests/integration/targets/hcloud_network
- tests/integration/targets/hcloud_placement_group
- tests/integration/targets/hcloud_primary_ip
- tests/integration/targets/hcloud_rdns
- tests/integration/targets/hcloud_route
- tests/integration/targets/hcloud_server
- tests/integration/targets/hcloud_server_network
Expand Down
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ repos:
- id: ansible-lint
name: ansible-lint
args: [--offline]
additional_dependencies:
- ansible-core>=2.13.3
- netaddr

- repo: local
hooks:
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/targets/hcloud_rdns/meta/main.yml

This file was deleted.

21 changes: 18 additions & 3 deletions tests/integration/targets/hcloud_rdns/tasks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
---
- name: Cleanup test_ssh_key
hetzner.hcloud.hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
- name: Cleanup test_server
hetzner.hcloud.hcloud_server:
name: "{{ hcloud_server_name }}"
state: absent

- name: Cleanup test_primary_ip
hetzner.hcloud.hcloud_primary_ip:
name: "{{ hcloud_primary_ip_name }}"
state: absent

- name: Cleanup test_floating_ip
hetzner.hcloud.hcloud_floating_ip:
name: "{{ hcloud_floating_ip_name }}"
state: absent

- name: Cleanup test_load_balancer
hetzner.hcloud.hcloud_load_balancer:
name: "{{ hcloud_load_balancer_name }}"
state: absent
36 changes: 31 additions & 5 deletions tests/integration/targets/hcloud_rdns/tasks/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
---
- name: Create test_ssh_key
hetzner.hcloud.hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
public_key: "{{ test_ssh_keypair.public_key }}"
register: test_ssh_key
- name: Create test_server
hetzner.hcloud.hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cx11
image: ubuntu-22.04
state: present
register: test_server

- name: Create test_primary_ip
hetzner.hcloud.hcloud_primary_ip:
name: "{{ hcloud_primary_ip_name }}"
type: ipv4
datacenter: fsn1-dc14
state: present
register: test_primary_ip

- name: Create test_floating_ip
hetzner.hcloud.hcloud_floating_ip:
name: "{{ hcloud_floating_ip_name }}"
type: ipv4
home_location: fsn1
state: present
register: test_floating_ip

- name: Create test_load_balancer
hetzner.hcloud.hcloud_load_balancer:
name: "{{ hcloud_load_balancer_name }}"
load_balancer_type: lb11
network_zone: eu-central
state: present
register: test_load_balancer
Loading

0 comments on commit c336f47

Please sign in to comment.