-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve tests using new setup_ssh_keypair helper (#285)
* test: use new setup_ssh_keypair helper Remove the previous setup_sshkey helper * ci: fix tmp dir location to please chattr
- Loading branch information
Showing
28 changed files
with
128 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/integration/targets/hcloud_placement_group/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- setup_ssh_keypair |
5 changes: 5 additions & 0 deletions
5
tests/integration/targets/hcloud_placement_group/tasks/cleanup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Cleanup test_ssh_key | ||
hetzner.hcloud.hcloud_ssh_key: | ||
name: "{{ hcloud_ssh_key_name }}" | ||
state: absent |
6 changes: 6 additions & 0 deletions
6
tests/integration/targets/hcloud_placement_group/tasks/prepare.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ | |
placement_group: "{{ hcloud_placement_group_name }}" | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: server | ||
- name: verify create server with placement group | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- setup_ssh_keypair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Cleanup test_ssh_key | ||
hetzner.hcloud.hcloud_ssh_key: | ||
name: "{{ hcloud_ssh_key_name }}" | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: setup | ||
- name: verify setup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Copyright: (c) 2019, Hetzner Cloud GmbH <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
hcloud_ssh_key_name: "{{ hcloud_ns }}" | ||
hcloud_server_name: "{{ hcloud_ns }}" | ||
hcloud_firewall_name: "{{ hcloud_ns }}" | ||
hcloud_primary_ip_name: "{{ hcloud_ns }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- setup_ssh_keypair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Cleanup test_ssh_key | ||
hetzner.hcloud.hcloud_ssh_key: | ||
name: "{{ hcloud_ssh_key_name }}" | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,7 +361,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: started | ||
register: main_server | ||
- name: verify create server with ssh key | ||
|
@@ -378,7 +378,7 @@ | |
name: "{{ hcloud_server_name }}" | ||
rescue_mode: "linux64" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: main_server | ||
check_mode: true | ||
|
@@ -392,7 +392,7 @@ | |
name: "{{ hcloud_server_name }}" | ||
rescue_mode: "linux64" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: main_server | ||
- name: verify activate rescue mode | ||
|
@@ -405,7 +405,7 @@ | |
hetzner.hcloud.hcloud_server: | ||
name: "{{ hcloud_server_name }}" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: main_server | ||
- name: verify activate rescue mode | ||
|
@@ -442,7 +442,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
rescue_mode: "linux64" | ||
state: started | ||
register: main_server | ||
|
@@ -471,7 +471,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
labels: | ||
key: value | ||
mylabel: "val123" | ||
|
@@ -490,7 +490,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
labels: | ||
key: other | ||
mylabel: "val123" | ||
|
@@ -509,7 +509,7 @@ | |
server_type: cx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
labels: | ||
mylabel: "val123" | ||
key: other | ||
|
@@ -537,7 +537,7 @@ | |
backups: true | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result | ||
- name: verify enable backups | ||
|
@@ -564,7 +564,7 @@ | |
server_type: cpx11 | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result_after_test | ||
ignore_errors: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ | |
- "{{ hcloud_firewall_name }}" | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result | ||
- name: verify test create server with firewalls | ||
|
@@ -51,7 +51,7 @@ | |
- "{{ hcloud_firewall_name }}" | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result | ||
- name: verify test create server with firewalls idempotence | ||
|
@@ -67,7 +67,7 @@ | |
- "{{ hcloud_firewall_name }}2" | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result | ||
- name: verify test update server with firewalls | ||
|
@@ -83,7 +83,7 @@ | |
- "{{ hcloud_firewall_name }}2" | ||
image: "ubuntu-22.04" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: present | ||
register: result | ||
- name: verify test update server with firewalls idempotence | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
ipv4: "{{primaryIPv4.hcloud_primary_ip.id}}" | ||
ipv6: "{{primaryIPv6.hcloud_primary_ip.id}}" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: stopped | ||
register: result | ||
- name: verify test create server with primary ips | ||
|
@@ -49,7 +49,7 @@ | |
ipv6: "" | ||
enable_ipv6: false | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: stopped | ||
register: result | ||
- name: verify test create server with primary ips | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ | |
private_networks: | ||
- "{{ primaryNetwork.hcloud_network.name }}" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: stopped | ||
register: result | ||
- name: verify test create server with primary network | ||
|
@@ -91,7 +91,7 @@ | |
- "{{ primaryNetwork.hcloud_network.name }}" | ||
- "{{ secondaryNetwork.hcloud_network.id }}" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: stopped | ||
register: result | ||
- name: verify test update server by adding secondary network | ||
|
@@ -111,7 +111,7 @@ | |
- "{{ primaryNetwork.hcloud_network.name }}" | ||
- "{{ secondaryNetwork.hcloud_network.id }}" | ||
ssh_keys: | ||
- [email protected] | ||
- "{{ hcloud_ssh_key_name }}" | ||
state: stopped | ||
register: result | ||
- name: verify test update server idem | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,3 @@ | |
--- | ||
hcloud_server_name: "{{ hcloud_ns }}" | ||
hcloud_ssh_key_name: "{{ hcloud_ns }}" | ||
hcloud_ssh_key_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnaTPfKaX1QKcRLOfr34buVLh5FhJAThI9NYB0xNdXsMd4Y0zLyyCQzHbx4eWCVZxym/s6csWSeLaAhO1GOHeAw3hQFMqf1oTBx6Y8g0pKpeotKPa/PDSUzdZF9Lc+DadtpQd8kFVHAu1Kd3zoEUnk1u6kP7I4qu4Z/6F9qBDF+M3aobiPVxdS7GwaVRW3nZu+FcQDLiBiNOjuRDyjHcDfEUkoh2SOu25RrFtGPzFu5mGmBJwotKpWAocLGfHzyn/fAHxgw3jKZVH/t+XWQFnl82Ie8yE3Z1EZ7oDkNRqFQT9AdXEQOLycTTYTQMJZpgeFTv3sAo6lPRCusiFmmLcf [email protected]" | ||
hcloud_ssh_key_fingerprint: "56:89:c4:d6:a7:4a:79:82:f4:c2:58:9c:e1:d2:2d:4e" | ||
|
||
hcloud_doubled_ssh_key_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1AiuN3UMQKzOs4tNudmlDSkSebC+savc6CivoHGflUKeli7nKb5pKgGiqH+zeWZc+8+flUa2BxsJWmi7d1nGJ++W4BnzmqW78ApelpJnGtuX8IKNcq/trhVTQyaShPiLluoBs7bXyyZpAKNGkk3jHrgwwYD/QQDN0CJnQUM18fjH5CUes2vmaG/kkhn7ctuVHDOvDcEy8KdBX3fYyrtXw5GgWDC5borG6yT1f3E9AXfRPL9OQjMTeC+G4FHscJAZjNnYav+jLrQLdV1xJ0JgbjRyBgTAfBszx9oKIjzCUPvpj4npju0WFGu10pIh0w7bluMoVn1tS6Y3gxE/Cepwt [email protected]" | ||
hcloud_doubled_ssh_key_fingerprint: "f9:33:40:ff:77:f3:3e:85:f2:9e:8f:98:71:fd:a0:58" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
--- | ||
dependencies: | ||
- setup_sshkey | ||
- setup_ssh_keypair |
10 changes: 10 additions & 0 deletions
10
tests/integration/targets/hcloud_ssh_key/tasks/cleanup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Cleanup test_ssh_key | ||
hetzner.hcloud.hcloud_ssh_key: | ||
name: "{{ hcloud_ssh_key_name }}" | ||
state: absent | ||
|
||
- name: Cleanup test_server | ||
hetzner.hcloud.hcloud_server: | ||
name: "{{ hcloud_server_name }}" | ||
state: absent |
Oops, something went wrong.