diff --git a/test/integration/targets/cloudscale_server/aliases b/test/integration/targets/cloudscale_server/aliases new file mode 100644 index 00000000000..c200a3d2c8a --- /dev/null +++ b/test/integration/targets/cloudscale_server/aliases @@ -0,0 +1,2 @@ +cloud/cloudscale +unsupported diff --git a/test/integration/targets/cloudscale_server/meta/main.yml b/test/integration/targets/cloudscale_server/meta/main.yml new file mode 100644 index 00000000000..8dd48f0337c --- /dev/null +++ b/test/integration/targets/cloudscale_server/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cloudscale_common diff --git a/test/integration/targets/cloudscale_server/tasks/main.yml b/test/integration/targets/cloudscale_server/tasks/main.yml new file mode 100644 index 00000000000..12c2e7dffa3 --- /dev/null +++ b/test/integration/targets/cloudscale_server/tasks/main.yml @@ -0,0 +1,230 @@ +--- +- name: Test create a running server in check mode + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + register: server + check_mode: yes +- name: Verify create a running server in check mode + assert: + that: + - server is changed + - server.state == 'absent' + +- name: Test create a running server + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + register: server +- name: Verify create a running server + assert: + that: + - server is changed + - server.state == 'running' + +- name: Test create a running server idempotence + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + register: server +- name: Verify create a running server idempotence + assert: + that: + - server is not changed + - server.state == 'running' + +- name: Test create server stopped in check mode + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test-stopped' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + state: stopped + check_mode: yes + register: server_stopped +- name: Verify create server stopped + assert: + that: + - server_stopped is changed + - server_stopped.state == 'absent' + +- name: Test create server stopped + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test-stopped' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + state: stopped + register: server_stopped +- name: Verify create server stopped + assert: + that: + - server_stopped is changed + - server_stopped.state == 'stopped' + +- name: Test create server stopped idempotence + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test-stopped' + flavor: '{{ cloudscale_test_flavor }}' + image: '{{ cloudscale_test_image }}' + ssh_keys: '{{ cloudscale_test_ssh_key }}' + state: stopped + register: server_stopped +- name: Verify create server stopped idempotence + assert: + that: + - server_stopped is not changed + - server_stopped.state == 'stopped' + +- name: Test create server failure without required parameters + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test-failed' + register: server_failed + ignore_errors: yes +- name: Verify create server failure without required parameters + assert: + that: + - server_failed is failed + - "'Missing required parameter(s)' in server_failed.msg" + +- name: Test stop running server in check mode + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: stopped + check_mode: yes + register: server +- name: Verify stop running server in check mode + assert: + that: + - server is changed + - server.state == 'running' + +- name: Test stop running server + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: stopped + register: server +- name: Verify stop running server + assert: + that: + - server is changed + - server.state == 'stopped' + +- name: Test stop running server idempotence + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: 'stopped' + register: server +- name: Verify stop running server idempotence + assert: + that: + - server is not changed + - server.state == 'stopped' + +- name: Test server running in check mode + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: running + register: server + check_mode: yes +- name: Verify server running in check mode + assert: + that: + - server is changed + - server.state == 'stopped' + +- name: Test server running + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: running + register: server +- name: Verify server running + assert: + that: + - server is changed + - server.state == 'running' + +- name: Test server running idempotence + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: running + register: server +- name: Verify server running idempotence + assert: + that: + - server is not changed + - server.state == 'running' + +- name: Test running server deletion by name in check mode + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: absent + register: server + check_mode: yes +- name: Verify running server deletion by name in check mode + assert: + that: + - server is changed + - server.state == 'running' + +- name: Test running server deletion by name + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: absent + register: server +- name: Verify running server deletion by name + assert: + that: + - server is changed + - server.state == 'absent' + +- name: Test running server deletion by name idempotence + cloudscale_server: + name: '{{ cloudscale_resource_prefix }}-test' + state: absent + register: server +- name: Verify running server deletion by name idempotence + assert: + that: + - server is not changed + - server.state == 'absent' + +- name: Test stopped server deletion by uuid in check mode + cloudscale_server: + uuid: '{{ server_stopped.uuid }}' + state: absent + register: server_stopped + check_mode: yes +- name: Verify stopped server deletion by uuid in check mode + assert: + that: + - server_stopped is changed + - server_stopped.state == 'stopped' + +- name: Test stopped server deletion by uuid + cloudscale_server: + uuid: '{{ server_stopped.uuid }}' + state: absent + register: server_stopped +- name: Verify stopped server deletion by uuid + assert: + that: + - server_stopped is changed + - server_stopped.state == 'absent' + +- name: Test stopped server deletion by uuid idempotence + cloudscale_server: + uuid: '{{ server_stopped.uuid }}' + state: absent + register: server_stopped +- name: Verify stopped server deletion by uuid idempotence + assert: + that: + - server_stopped is not changed + - server_stopped.state == 'absent' diff --git a/test/legacy/cloudscale.yml b/test/legacy/cloudscale.yml index 4c8c03c40aa..b0eb5b3897e 100644 --- a/test/legacy/cloudscale.yml +++ b/test/legacy/cloudscale.yml @@ -4,5 +4,4 @@ tags: - cloudscale roles: - - { role: cloudscale_server, tags: cloudscale_server } - { role: cloudscale_floating_ip, tags: cloudscale_floating_ip } diff --git a/test/legacy/roles/cloudscale_server/defaults/main.yml b/test/legacy/roles/cloudscale_server/defaults/main.yml deleted file mode 100644 index f318a20f641..00000000000 --- a/test/legacy/roles/cloudscale_server/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -cloudscale_test_flavor: flex-2 -cloudscale_test_image: debian-9 -cloudscale_test_ssh_key: | - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible diff --git a/test/legacy/roles/cloudscale_server/meta/main.yml b/test/legacy/roles/cloudscale_server/meta/main.yml deleted file mode 100644 index 07faa217762..00000000000 --- a/test/legacy/roles/cloudscale_server/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_tests diff --git a/test/legacy/roles/cloudscale_server/tasks/main.yml b/test/legacy/roles/cloudscale_server/tasks/main.yml deleted file mode 100644 index 22301546b40..00000000000 --- a/test/legacy/roles/cloudscale_server/tasks/main.yml +++ /dev/null @@ -1,138 +0,0 @@ ---- -- name: Test create server - cloudscale_server: - name: '{{ resource_prefix }}-test' - flavor: '{{ cloudscale_test_flavor }}' - image: '{{ cloudscale_test_image }}' - ssh_keys: '{{ cloudscale_test_ssh_key }}' - register: server -- name: Verify create server - assert: - that: - - server is successful - - server is changed - - server.state == 'running' - -- name: Test create server indempotence - cloudscale_server: - name: '{{ resource_prefix }}-test' - flavor: '{{ cloudscale_test_flavor }}' - image: '{{ cloudscale_test_image }}' - ssh_keys: '{{ cloudscale_test_ssh_key }}' - register: server -- name: Verify create server - assert: - that: - - server is successful - - server is not changed - - server.state == 'running' - -- name: Test create server stopped - cloudscale_server: - name: '{{ resource_prefix }}-test-stopped' - flavor: '{{ cloudscale_test_flavor }}' - image: '{{ cloudscale_test_image }}' - ssh_keys: '{{ cloudscale_test_ssh_key }}' - state: 'stopped' - register: server_stopped -- name: Verify create server stopped - assert: - that: - - server_stopped is successful - - server_stopped is changed - - server_stopped.state == 'stopped' - -- name: Test create server failure without required parameters - cloudscale_server: - name: '{{ resource_prefix }}-test-failed' - register: server_failed - ignore_errors: True -- name: Verify create server failure without required parameters - assert: - that: - - server_failed is failed - - "'Missing required parameter' in server_failed.msg" - -- name: Test server stopped - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'stopped' - register: server -- name: Verify server stopped - assert: - that: - - server is successful - - server is changed - - server.state == 'stopped' - -- name: Test server stopped indempotence - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'stopped' - register: server -- name: Verify server stopped indempotence - assert: - that: - - server is successful - - server is not changed - - server.state == 'stopped' - -- name: Test server running - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'running' - register: server -- name: Verify server running - assert: - that: - - server is successful - - server is changed - - server.state == 'running' - -- name: Test server running indempotence - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'running' - register: server -- name: Verify server running indempotence - assert: - that: - - server is successful - - server is not changed - - server.state == 'running' - -- name: Test server deletion by name - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'absent' - register: server -- name: Verify server deletion - assert: - that: - - server is successful - - server is changed - - server.state == 'absent' - -- name: Test server deletion by uuid - cloudscale_server: - uuid: '{{ server_stopped.uuid }}' - state: 'absent' - register: server_stopped -- name: Verify server deletion by uuid - assert: - that: - - server_stopped is successful - - server_stopped is changed - - server_stopped.state == 'absent' - -- name: Test server deletion indempotence - cloudscale_server: - name: '{{ resource_prefix }}-test' - state: 'absent' - register: server -- name: Verify server deletion - assert: - that: - - server is successful - - server is not changed - - server.state == 'absent'