hcloud: Fix testsuite (#55076)

This commit is contained in:
Lukas Kämmerling
2019-04-10 15:16:10 +02:00
committed by René Moser
parent a971a0eb80
commit 3f579eb68f
21 changed files with 47 additions and 75 deletions

View File

@@ -1,21 +1,12 @@
# 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: setup
hcloud_ssh_key:
fingerprint: "{{ hcloud_ssh_key_fingerprint }}"
state: absent
register: result
- name: verify setup
assert:
that:
- result is success
- name: test missing required parameters on create ssh_key
hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
register: result
ignore_errors: yes
- name: verify fail test missing required parameters on create server
- name: verify fail test missing required parameters on create ssh_key
assert:
that:
- result is failed
@@ -24,7 +15,7 @@
- name: test create ssh key with check mode
hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
public_key: "{{ hcloud_ssh_key_public_key }}"
public_key: "{{ key_material }}"
register: result
check_mode: yes
- name: test create ssh key with check mode
@@ -35,7 +26,7 @@
- name: test create ssh key
hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
public_key: "{{ hcloud_ssh_key_public_key }}"
public_key: "{{ key_material }}"
labels:
key: value
my-label: label
@@ -45,14 +36,13 @@
that:
- sshKey is changed
- sshKey.hcloud_ssh_key.name == "{{ hcloud_ssh_key_name }}"
- sshKey.hcloud_ssh_key.public_key == "{{ hcloud_ssh_key_public_key }}"
- sshKey.hcloud_ssh_key.fingerprint == "{{ hcloud_ssh_key_fingerprint }}"
- sshKey.hcloud_ssh_key.public_key == "{{ key_material }}"
- sshKey.hcloud_ssh_key.labels.key == "value"
- name: test create ssh key idempotence
hcloud_ssh_key:
name: "{{ hcloud_ssh_key_name }}"
public_key: "{{ hcloud_ssh_key_public_key }}"
public_key: "{{ key_material }}"
register: result
- name: verify create ssh key idempotence
assert:
@@ -62,7 +52,7 @@
- name: test update ssh key with check mode
hcloud_ssh_key:
id: "{{ sshKey.hcloud_ssh_key.id }}"
name: "changed-ssh-key-name"
name: "changed-{{ hcloud_ssh_key_name }}"
register: result
check_mode: yes
- name: test create ssh key with check mode
@@ -73,7 +63,7 @@
- name: test update ssh key
hcloud_ssh_key:
id: "{{ sshKey.hcloud_ssh_key.id }}"
name: "changed-ssh-key-name"
name: "changed-{{ hcloud_ssh_key_name }}"
labels:
key: value
register: result
@@ -81,16 +71,16 @@
assert:
that:
- result is changed
- result.hcloud_ssh_key.name == "changed-ssh-key-name"
- result.hcloud_ssh_key.name == "changed-{{ hcloud_ssh_key_name }}"
- name: test update ssh key with same labels
hcloud_ssh_key:
id: "{{ sshKey.hcloud_ssh_key.id }}"
name: "changed-ssh-key-name"
name: "changed-{{ hcloud_ssh_key_name }}"
labels:
key: value
register: result
- name: test update ssh key with same labels
- name: test update ssh key with same labels
assert:
that:
- result is not changed
@@ -98,7 +88,7 @@
- name: test update ssh key with other labels
hcloud_ssh_key:
id: "{{ sshKey.hcloud_ssh_key.id }}"
name: "changed-ssh-key-name"
name: "changed-{{ hcloud_ssh_key_name }}"
labels:
key: value
test: 123