diff options
Diffstat (limited to 'test/integration/targets')
19 files changed, 45 insertions, 73 deletions
diff --git a/test/integration/targets/hcloud_floating_ip_facts/aliases b/test/integration/targets/hcloud_floating_ip_facts/aliases index 4b3a9b36f8..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_floating_ip_facts/aliases +++ b/test/integration/targets/hcloud_floating_ip_facts/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled diff --git a/test/integration/targets/hcloud_floating_ip_facts/tasks/main.yml b/test/integration/targets/hcloud_floating_ip_facts/tasks/main.yml index 39a386cf0b..a29cc10ff0 100644 --- a/test/integration/targets/hcloud_floating_ip_facts/tasks/main.yml +++ b/test/integration/targets/hcloud_floating_ip_facts/tasks/main.yml @@ -1,51 +1,53 @@ # 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: test gather hcloud image facts +- name: test gather hcloud floating ip facts hcloud_floating_ip_facts: -- name: verify test gather hcloud image facts in check mode +- name: verify test gather hcloud floating ip facts in check mode assert: that: - ansible_facts.hcloud_floating_ip_facts| list | count == 1 -- name: test gather hcloud image facts in check mode +- name: test gather hcloud floating ip facts in check mode hcloud_floating_ip_facts: check_mode: yes -- name: verify test gather hcloud image facts in check mode +- name: verify test gather hcloud floating ip facts in check mode assert: that: - ansible_facts.hcloud_floating_ip_facts| list | count == 1 -- name: test gather hcloud image facts with correct label selector +- name: test gather hcloud floating ip facts with correct label selector hcloud_floating_ip_facts: label_selector: "key=value" -- name: verify test gather hcloud image with correct label selector +- name: verify test gather hcloud floating ip with correct label selector assert: that: - ansible_facts.hcloud_floating_ip_facts|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1 -- name: test gather hcloud image facts with wrong label selector +- name: test gather hcloud floating ip facts with wrong label selector hcloud_floating_ip_facts: label_selector: "key!=value" -- name: verify test gather hcloud image with wrong label selector +- name: verify test gather hcloud floating ip with wrong label selector assert: that: - ansible_facts.hcloud_floating_ip_facts | list | count == 0 -- name: test gather hcloud image facts with correct id +- name: test gather hcloud floating ip facts with correct id hcloud_floating_ip_facts: id: "{{hcloud_test_floating_ip_id}}" -- name: verify test gather hcloud image with correct id +- name: verify test gather hcloud floating ip with correct id assert: that: - ansible_facts.hcloud_floating_ip_facts|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1 -- name: test gather hcloud image facts with wrong id +- name: test gather hcloud floating ip facts with wrong id hcloud_floating_ip_facts: id: "{{hcloud_test_floating_ip_id}}1" -- name: verify test gather hcloud image with wrong id + register: result + ignore_errors: yes +- name: verify test gather hcloud floating ip with wrong id assert: that: - - ansible_facts.hcloud_floating_ip_facts | list | count == 0 + - result is failed diff --git a/test/integration/targets/hcloud_image_facts/aliases b/test/integration/targets/hcloud_image_facts/aliases index 4b3a9b36f8..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_image_facts/aliases +++ b/test/integration/targets/hcloud_image_facts/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled diff --git a/test/integration/targets/hcloud_image_facts/tasks/main.yml b/test/integration/targets/hcloud_image_facts/tasks/main.yml index d444dc3164..b44b08a61f 100644 --- a/test/integration/targets/hcloud_image_facts/tasks/main.yml +++ b/test/integration/targets/hcloud_image_facts/tasks/main.yml @@ -49,7 +49,9 @@ hcloud_image_facts: id: "{{hcloud_test_image_id}}1" type: snapshot + ignore_errors: yes + register: result - name: verify test gather hcloud image with wrong id assert: that: - - ansible_facts.hcloud_image_facts | list | count == 0 + - result is failed diff --git a/test/integration/targets/hcloud_server/aliases b/test/integration/targets/hcloud_server/aliases index 4b3a9b36f8..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_server/aliases +++ b/test/integration/targets/hcloud_server/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled diff --git a/test/integration/targets/hcloud_server/tasks/main.yml b/test/integration/targets/hcloud_server/tasks/main.yml index ce0524d971..e901ca59d0 100644 --- a/test/integration/targets/hcloud_server/tasks/main.yml +++ b/test/integration/targets/hcloud_server/tasks/main.yml @@ -239,24 +239,26 @@ - name: test rebuild server hcloud_server: name: "{{ hcloud_server_name }}" + image: ubuntu-18.04 state: rebuild register: result_after_test - name: verify rebuild server assert: that: - - result is changed + - result_after_test is changed - result.hcloud_server.id == result_after_test.hcloud_server.id - name: test rebuild server with check mode hcloud_server: name: "{{ hcloud_server_name }}" + image: ubuntu-18.04 state: rebuild register: result_after_test check_mode: true - name: verify rebuild server with check mode assert: that: - - result is changed + - result_after_test is changed - name: absent server hcloud_server: diff --git a/test/integration/targets/hcloud_server_facts/aliases b/test/integration/targets/hcloud_server_facts/aliases index 965a4decc1..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_server_facts/aliases +++ b/test/integration/targets/hcloud_server_facts/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -unstable # tests are unstable because they conflict when run concurrently diff --git a/test/integration/targets/hcloud_server_facts/tasks/main.yml b/test/integration/targets/hcloud_server_facts/tasks/main.yml index d81d0f9525..d67eaef2bc 100644 --- a/test/integration/targets/hcloud_server_facts/tasks/main.yml +++ b/test/integration/targets/hcloud_server_facts/tasks/main.yml @@ -7,13 +7,6 @@ state: absent register: result -- name: test gather hcloud server facts - empty resources - hcloud_server_facts: -- name: verify test gather hcloud server facts - empty resources - assert: - that: - - ansible_facts.hcloud_server_facts | count == 0 - - name: create server hcloud_server: name: "{{ hcloud_server_name }}" diff --git a/test/integration/targets/hcloud_ssh_key/aliases b/test/integration/targets/hcloud_ssh_key/aliases index 328499983d..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_ssh_key/aliases +++ b/test/integration/targets/hcloud_ssh_key/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled # conflicts with concurrent runs diff --git a/test/integration/targets/hcloud_ssh_key/meta/main.yml b/test/integration/targets/hcloud_ssh_key/meta/main.yml new file mode 100644 index 0000000000..7e4c5b7eb4 --- /dev/null +++ b/test/integration/targets/hcloud_ssh_key/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_sshkey diff --git a/test/integration/targets/hcloud_ssh_key/tasks/main.yml b/test/integration/targets/hcloud_ssh_key/tasks/main.yml index 57c2ee0128..f935674684 100644 --- a/test/integration/targets/hcloud_ssh_key/tasks/main.yml +++ b/test/integration/targets/hcloud_ssh_key/tasks/main.yml @@ -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 diff --git a/test/integration/targets/hcloud_ssh_key_facts/aliases b/test/integration/targets/hcloud_ssh_key_facts/aliases index 4b3a9b36f8..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_ssh_key_facts/aliases +++ b/test/integration/targets/hcloud_ssh_key_facts/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled diff --git a/test/integration/targets/hcloud_ssh_key_facts/defaults/main.yml b/test/integration/targets/hcloud_ssh_key_facts/defaults/main.yml index 3b05f41406..06c1471ad3 100644 --- a/test/integration/targets/hcloud_ssh_key_facts/defaults/main.yml +++ b/test/integration/targets/hcloud_ssh_key_facts/defaults/main.yml @@ -1,4 +1,5 @@ # 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) --- -hcloud_ssh_key_name: "test_ssh_key" +hcloud_prefix: "tests" +hcloud_ssh_key_name: "{{hcloud_prefix}}-ssh_key_facts" diff --git a/test/integration/targets/hcloud_ssh_key_facts/meta/main.yml b/test/integration/targets/hcloud_ssh_key_facts/meta/main.yml new file mode 100644 index 0000000000..7e4c5b7eb4 --- /dev/null +++ b/test/integration/targets/hcloud_ssh_key_facts/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_sshkey diff --git a/test/integration/targets/hcloud_ssh_key_facts/tasks/main.yml b/test/integration/targets/hcloud_ssh_key_facts/tasks/main.yml index 79260e1810..8c574f6721 100644 --- a/test/integration/targets/hcloud_ssh_key_facts/tasks/main.yml +++ b/test/integration/targets/hcloud_ssh_key_facts/tasks/main.yml @@ -8,17 +8,10 @@ state: absent register: result -- name: test gather hcloud ssh key facts - empty resources - hcloud_ssh_key_facts: -- name: verify test gather hcloud ssh key facts - empty resources - assert: - that: - - ansible_facts.hcloud_ssh_key_facts | count == 0 - - name: setup test ssh_key hcloud_ssh_key: name: "{{hcloud_ssh_key_name}}" - public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpl/tnk74nnQJxxLAtutUApUZMRJxryKh7VXkNbd4g9 john@example.com" + public_key: "{{ key_material }}" labels: key: value register: result @@ -26,7 +19,7 @@ assert: that: - result is changed - - result.hcloud_ssh_key.public_key == "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpl/tnk74nnQJxxLAtutUApUZMRJxryKh7VXkNbd4g9 john@example.com" + - result.hcloud_ssh_key.public_key == "{{ key_material }}" - name: test gather hcloud ssh key facts in check mode hcloud_ssh_key_facts: @@ -34,7 +27,7 @@ - name: verify test gather hcloud ssh key facts in check mode assert: that: - - ansible_facts.hcloud_ssh_key_facts| list | count == 1 + - ansible_facts.hcloud_ssh_key_facts| list | count >= 1 - name: test gather hcloud ssh key facts hcloud_ssh_key_facts: @@ -42,7 +35,7 @@ - name: verify test gather hcloud ssh key facts assert: that: - - ansible_facts.hcloud_ssh_key_facts| list | count == 1 + - ansible_facts.hcloud_ssh_key_facts| list | count >= 1 - name: test gather hcloud ssh key facts with correct label selector hcloud_ssh_key_facts: @@ -60,7 +53,6 @@ that: - ansible_facts.hcloud_ssh_key_facts | list | count == 0 - - name: cleanup hcloud_ssh_key: name: "{{hcloud_ssh_key_name}}" diff --git a/test/integration/targets/hcloud_volume/defaults/main.yml b/test/integration/targets/hcloud_volume/defaults/main.yml index ad7469fb29..a8f03b4e57 100644 --- a/test/integration/targets/hcloud_volume/defaults/main.yml +++ b/test/integration/targets/hcloud_volume/defaults/main.yml @@ -3,4 +3,4 @@ --- hcloud_prefix: "tests" hcloud_volume_name: "{{hcloud_prefix}}-integ" -hcloud_server_name: "{{hcloud_prefix}}-integ-server" +hcloud_server_name: "{{hcloud_prefix}}-volume-server" diff --git a/test/integration/targets/hcloud_volume_facts/aliases b/test/integration/targets/hcloud_volume_facts/aliases index 4b3a9b36f8..18dc30b6c3 100644 --- a/test/integration/targets/hcloud_volume_facts/aliases +++ b/test/integration/targets/hcloud_volume_facts/aliases @@ -1,3 +1,2 @@ cloud/hcloud shippable/hcloud/group1 -disabled diff --git a/test/integration/targets/hcloud_volume_facts/defaults/main.yml b/test/integration/targets/hcloud_volume_facts/defaults/main.yml index 5842641c75..d308c95090 100644 --- a/test/integration/targets/hcloud_volume_facts/defaults/main.yml +++ b/test/integration/targets/hcloud_volume_facts/defaults/main.yml @@ -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}}-integ" +hcloud_volume_name: "{{hcloud_prefix}}-facts" diff --git a/test/integration/targets/hcloud_volume_facts/tasks/main.yml b/test/integration/targets/hcloud_volume_facts/tasks/main.yml index 184534661a..9eae2e9a1a 100644 --- a/test/integration/targets/hcloud_volume_facts/tasks/main.yml +++ b/test/integration/targets/hcloud_volume_facts/tasks/main.yml @@ -7,13 +7,6 @@ state: absent register: result -- name: test gather hcloud volume facts - empty resources - hcloud_volume_facts: -- name: verify test gather hcloud volume facts - empty resources - assert: - that: - - ansible_facts.hcloud_volume_facts | count == 0 - - name: setup volume hcloud_volume: name: "{{hcloud_volume_name}}" |