mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: more integration tests
This commit is contained in:
parent
b43939dfd6
commit
9514ac860d
4 changed files with 257 additions and 22 deletions
|
@ -224,3 +224,117 @@
|
||||||
that:
|
that:
|
||||||
- acc|success
|
- acc|success
|
||||||
- not acc|changed
|
- not acc|changed
|
||||||
|
|
||||||
|
- name: test create user disabled account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
username: "{{ cs_resource_prefix }}_username"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
network_domain: "{{ cs_resource_prefix }}.local"
|
||||||
|
state: disabled
|
||||||
|
register: acc
|
||||||
|
- name: verify results of create disabled account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "disabled"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove disabled user account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: acc
|
||||||
|
- name: verify results of remove disabled user account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "disabled"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test create user locked account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
username: "{{ cs_resource_prefix }}_username"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
network_domain: "{{ cs_resource_prefix }}.local"
|
||||||
|
state: locked
|
||||||
|
register: acc
|
||||||
|
- name: verify results of create locked account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "locked"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove locked user account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: acc
|
||||||
|
- name: verify results of remove locked user account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "locked"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test create user unlocked/enabled account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
username: "{{ cs_resource_prefix }}_username"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
network_domain: "{{ cs_resource_prefix }}.local"
|
||||||
|
state: unlocked
|
||||||
|
register: acc
|
||||||
|
- name: verify results of create unlocked/enabled account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "enabled"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove unlocked/enabled user account
|
||||||
|
cs_account:
|
||||||
|
name: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: acc
|
||||||
|
- name: verify results of remove unlocked/enabled user account
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- acc|success
|
||||||
|
- acc|changed
|
||||||
|
- acc.name == "{{ cs_resource_prefix }}_user"
|
||||||
|
- acc.network_domain == "{{ cs_resource_prefix }}.local"
|
||||||
|
- acc.account_type == "user"
|
||||||
|
- acc.state == "enabled"
|
||||||
|
- acc.domain == "ROOT"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- include: setup.yml
|
- include: setup.yml
|
||||||
- include: present.yml
|
- include: present.yml
|
||||||
#- include: tags.yml
|
- include: tags.yml
|
||||||
- include: absent.yml
|
- include: absent.yml
|
||||||
- include: cleanup.yml
|
- include: cleanup.yml
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
- name: test add tags to instance
|
- name: test add tags to instance
|
||||||
cs_instance:
|
cs_instance:
|
||||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
template: "{{ test_cs_instance_template }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||||
tags:
|
tags:
|
||||||
- { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" }
|
- { key: "{{ cs_resource_prefix }}-tag1", value: "{{ cs_resource_prefix }}-value1" }
|
||||||
- { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" }
|
- { key: "{{ cs_resource_prefix }}-tag2", value: "{{ cs_resource_prefix }}-value2" }
|
||||||
|
@ -12,11 +14,10 @@
|
||||||
- instance|success
|
- instance|success
|
||||||
- instance|changed
|
- instance|changed
|
||||||
- instance.tags|length == 2
|
- instance.tags|length == 2
|
||||||
- instance.tags[0]['key'] == "{{ cs_resource_prefix }}-tag1"
|
- "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]"
|
||||||
- instance.tags[1]['key'] == "{{ cs_resource_prefix }}-tag2"
|
- "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]"
|
||||||
- instance.tags[0]['value'] == "{{ cs_resource_prefix }}-value1"
|
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||||
- instance.tags[1]['value'] == "{{ cs_resource_prefix }}-value2"
|
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||||
|
|
||||||
|
|
||||||
- name: test tags to instance idempotence
|
- name: test tags to instance idempotence
|
||||||
cs_instance:
|
cs_instance:
|
||||||
|
@ -31,10 +32,10 @@
|
||||||
- instance|success
|
- instance|success
|
||||||
- not instance|changed
|
- not instance|changed
|
||||||
- instance.tags|length == 2
|
- instance.tags|length == 2
|
||||||
- instance.tags[0]['key'] == "{{ cs_resource_prefix }}-tag1"
|
- "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]"
|
||||||
- instance.tags[1]['key'] == "{{ cs_resource_prefix }}-tag2"
|
- "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag1' ]"
|
||||||
- instance.tags[0]['value'] == "{{ cs_resource_prefix }}-value1"
|
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||||
- instance.tags[1]['value'] == "{{ cs_resource_prefix }}-value2"
|
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value1' ]"
|
||||||
|
|
||||||
- name: test change tags of instance
|
- name: test change tags of instance
|
||||||
cs_instance:
|
cs_instance:
|
||||||
|
@ -47,12 +48,12 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- instance|success
|
- instance|success
|
||||||
- not instance|changed
|
- instance|changed
|
||||||
- instance.tags|length == 2
|
- instance.tags|length == 2
|
||||||
- instance.tags[0]['key'] == "{{ cs_resource_prefix }}-tag1"
|
- "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]"
|
||||||
- instance.tags[1]['key'] == "{{ cs_resource_prefix }}-tag3"
|
- "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]"
|
||||||
- instance.tags[0]['value'] == "{{ cs_resource_prefix }}-value1"
|
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||||
- instance.tags[1]['value'] == "{{ cs_resource_prefix }}-value3"
|
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||||
|
|
||||||
- name: test not touch tags of instance if no param tags
|
- name: test not touch tags of instance if no param tags
|
||||||
cs_instance:
|
cs_instance:
|
||||||
|
@ -64,10 +65,10 @@
|
||||||
- instance|success
|
- instance|success
|
||||||
- not instance|changed
|
- not instance|changed
|
||||||
- instance.tags|length == 2
|
- instance.tags|length == 2
|
||||||
- instance.tags[0]['key'] == "{{ cs_resource_prefix }}-tag1"
|
- "instance.tags[0]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]"
|
||||||
- instance.tags[1]['key'] == "{{ cs_resource_prefix }}-tag3"
|
- "instance.tags[1]['key'] in [ '{{ cs_resource_prefix }}-tag2', '{{ cs_resource_prefix }}-tag3' ]"
|
||||||
- instance.tags[0]['value'] == "{{ cs_resource_prefix }}-value1"
|
- "instance.tags[0]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||||
- instance.tags[1]['value'] == "{{ cs_resource_prefix }}-value3"
|
- "instance.tags[1]['value'] in [ '{{ cs_resource_prefix }}-value2', '{{ cs_resource_prefix }}-value3' ]"
|
||||||
|
|
||||||
- name: test remove tags
|
- name: test remove tags
|
||||||
cs_instance:
|
cs_instance:
|
||||||
|
@ -78,5 +79,5 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- instance|success
|
- instance|success
|
||||||
- not instance|changed
|
- instance|changed
|
||||||
- instance.tags|length == 0
|
- instance.tags|length == 0
|
||||||
|
|
|
@ -232,10 +232,10 @@
|
||||||
- user.state == "enabled"
|
- user.state == "enabled"
|
||||||
- user.domain == "ROOT"
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
- name: test enable user idempotence
|
- name: test enable user idempotence using unlocked
|
||||||
cs_user:
|
cs_user:
|
||||||
username: "{{ cs_resource_prefix }}_user"
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
state: enabled
|
state: unlocked
|
||||||
register: user
|
register: user
|
||||||
- name: verify results of enable user idempotence
|
- name: verify results of enable user idempotence
|
||||||
assert:
|
assert:
|
||||||
|
@ -274,3 +274,123 @@
|
||||||
that:
|
that:
|
||||||
- user|success
|
- user|success
|
||||||
- not user|changed
|
- not user|changed
|
||||||
|
|
||||||
|
- name: test create locked user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
account: "admin"
|
||||||
|
state: locked
|
||||||
|
register: user
|
||||||
|
- name: verify results of create locked user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.first_name == "{{ cs_resource_prefix }}_first_name"
|
||||||
|
- user.last_name == "{{ cs_resource_prefix }}_last_name"
|
||||||
|
- user.email == "{{ cs_resource_prefix }}@example.com"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "locked"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove locked user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: user
|
||||||
|
- name: verify results of remove locked user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "locked"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test create disabled user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
account: "admin"
|
||||||
|
state: disabled
|
||||||
|
register: user
|
||||||
|
- name: verify results of create disabled user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.first_name == "{{ cs_resource_prefix }}_first_name"
|
||||||
|
- user.last_name == "{{ cs_resource_prefix }}_last_name"
|
||||||
|
- user.email == "{{ cs_resource_prefix }}@example.com"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "disabled"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove disabled user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: user
|
||||||
|
- name: verify results of remove disabled user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "disabled"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test create enabled user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
password: "{{ cs_resource_prefix }}_password"
|
||||||
|
last_name: "{{ cs_resource_prefix }}_last_name"
|
||||||
|
first_name: "{{ cs_resource_prefix }}_first_name"
|
||||||
|
email: "{{ cs_resource_prefix }}@example.com"
|
||||||
|
account: "admin"
|
||||||
|
state: enabled
|
||||||
|
register: user
|
||||||
|
- name: verify results of create enabled user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.first_name == "{{ cs_resource_prefix }}_first_name"
|
||||||
|
- user.last_name == "{{ cs_resource_prefix }}_last_name"
|
||||||
|
- user.email == "{{ cs_resource_prefix }}@example.com"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "enabled"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
||||||
|
- name: test remove enabled user
|
||||||
|
cs_user:
|
||||||
|
username: "{{ cs_resource_prefix }}_user"
|
||||||
|
state: absent
|
||||||
|
register: user
|
||||||
|
- name: verify results of remove enabled user
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- user|success
|
||||||
|
- user|changed
|
||||||
|
- user.username == "{{ cs_resource_prefix }}_user"
|
||||||
|
- user.account_type == "root_admin"
|
||||||
|
- user.account == "admin"
|
||||||
|
- user.state == "enabled"
|
||||||
|
- user.domain == "ROOT"
|
||||||
|
|
Loading…
Reference in a new issue