mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: cs_instance: extent integration tests for ssh key handling
This commit is contained in:
parent
37b22673fb
commit
c92170e90d
2 changed files with 172 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
|||
---
|
||||
- include: setup.yml
|
||||
|
||||
- include: present.yml
|
||||
- include: tags.yml
|
||||
- include: absent.yml
|
||||
- include: cleanup.yml
|
||||
|
||||
- include: setup.yml
|
||||
- include: present_display_name.yml
|
||||
- include: absent_display_name.yml
|
||||
|
||||
- include: sshkeys.yml
|
||||
|
||||
- include: cleanup.yml
|
||||
|
|
168
test/integration/targets/cs_instance/tasks/sshkeys.yml
Normal file
168
test/integration/targets/cs_instance/tasks/sshkeys.yml
Normal file
|
@ -0,0 +1,168 @@
|
|||
---
|
||||
- name: test update instance ssh key non existent
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
force: true
|
||||
register: instance
|
||||
ignore_errors: true
|
||||
- name: verify update instance ssh key non existent
|
||||
assert:
|
||||
that:
|
||||
- instance|failed
|
||||
- 'instance.msg == "SSH key not found: {{ cs_resource_prefix }}-sshkey2"'
|
||||
|
||||
- name: test create instance without keypair in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
check_mode: true
|
||||
register: instance
|
||||
- name: verify create instance without keypair in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
|
||||
- name: test create instance without keypair
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance without keypair
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- instance|changed
|
||||
- instance.ssh_key is not defined
|
||||
|
||||
- name: test create instance without keypair idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance without keypair idempotence
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
- instance.ssh_key is not defined
|
||||
|
||||
- name: setup ssh key2
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey2
|
||||
register: sshkey
|
||||
- name: verify setup ssh key2
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
|
||||
- name: test update instance ssh key2 in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
|
||||
force: true
|
||||
check_mode: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key2 in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|changed
|
||||
- instance.ssh_key is not defined
|
||||
|
||||
- name: test update instance ssh key2
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
|
||||
force: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key2
|
||||
assert:
|
||||
that:
|
||||
- instance|changed
|
||||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey2"
|
||||
|
||||
- name: test update instance ssh key2 idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
|
||||
force: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key2 idempotence
|
||||
assert:
|
||||
that:
|
||||
- not instance|changed
|
||||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey2"
|
||||
|
||||
- name: cleanup ssh key2
|
||||
cs_sshkeypair:
|
||||
name: "{{ cs_resource_prefix }}-sshkey2"
|
||||
state: absent
|
||||
register: sshkey2
|
||||
- name: verify cleanup ssh key2
|
||||
assert:
|
||||
that:
|
||||
- sshkey2|success
|
||||
|
||||
- name: test update instance ssh key2 idempotence2
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey2"
|
||||
force: true
|
||||
register: instance
|
||||
ignore_errors: true
|
||||
- name: verify update instance ssh key2 idempotence2
|
||||
assert:
|
||||
that:
|
||||
- instance|failed
|
||||
- 'instance.msg == "SSH key not found: {{ cs_resource_prefix }}-sshkey2"'
|
||||
|
||||
- name: test update instance ssh key in check mode
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey"
|
||||
force: true
|
||||
check_mode: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key in check mode
|
||||
assert:
|
||||
that:
|
||||
- instance|changed
|
||||
- instance.ssh_key is not defined
|
||||
|
||||
- name: test update instance ssh key
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey"
|
||||
force: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key
|
||||
assert:
|
||||
that:
|
||||
- instance|changed
|
||||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
|
||||
|
||||
- name: test update instance ssh key idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey"
|
||||
force: true
|
||||
register: instance
|
||||
- name: verify update instance ssh key idempotence
|
||||
assert:
|
||||
that:
|
||||
- not instance|changed
|
||||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
|
||||
|
||||
- name: cleanup expunge instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-sshkey"
|
||||
state: expunged
|
||||
register: instance
|
||||
- name: verify cleanup expunge instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
Loading…
Reference in a new issue