1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: new integration tests test_cs_resourcelimit

This commit is contained in:
Rene Moser 2016-02-02 20:21:30 +01:00
parent 4d6a15ebc3
commit 5d5d905e36
5 changed files with 217 additions and 0 deletions

View file

@ -27,3 +27,4 @@
- { role: test_cs_configuration, tags: test_cs_configuration } - { role: test_cs_configuration, tags: test_cs_configuration }
- { role: test_cs_pod, tags: test_cs_pod } - { role: test_cs_pod, tags: test_cs_pod }
- { role: test_cs_cluster, tags: test_cs_cluster } - { role: test_cs_cluster, tags: test_cs_cluster }
- { role: test_cs_resourcelimit, tags: test_cs_resourcelimit }

View file

@ -0,0 +1,3 @@
---
dependencies:
- test_cs_common

View file

@ -0,0 +1,76 @@
---
- name: setup cpu limits account
cs_resourcelimit:
type: cpu
limit: 20
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify setup cpu limits account
assert:
that:
- rl|success
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 20
- rl.resource_type == "cpu"
- name: set cpu limits for domain
cs_resourcelimit:
type: cpu
limit: 12
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set cpu limits for domain
assert:
that:
- rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.limit == 12
- rl.resource_type == "cpu"
- name: set cpu limits for domain idempotence
cs_resourcelimit:
type: cpu
limit: 12
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set cpu limits for domain
assert:
that:
- not rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.limit == 12
- rl.resource_type == "cpu"
- name: set cpu limits for account
cs_resourcelimit:
type: cpu
limit: 10
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set cpu limits for account
assert:
that:
- rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 10
- rl.resource_type == "cpu"
- name: set cpu limits for account idempotence
cs_resourcelimit:
type: cpu
limit: 10
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set cpu limits for account idempotence
assert:
that:
- not rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 10
- rl.resource_type == "cpu"

View file

@ -0,0 +1,76 @@
---
- name: setup instance limits account
cs_resourcelimit:
type: instance
limit: 20
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify setup instance limits account
assert:
that:
- rl|success
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 20
- rl.resource_type == "instance"
- name: set instance limits for domain
cs_resourcelimit:
type: instance
limit: 12
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set instance limits for domain
assert:
that:
- rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.limit == 12
- rl.resource_type == "instance"
- name: set instance limits for domain idempotence
cs_resourcelimit:
type: instance
limit: 12
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set instance limits for domain
assert:
that:
- not rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.limit == 12
- rl.resource_type == "instance"
- name: set instance limits for account
cs_resourcelimit:
type: instance
limit: 10
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set instance limits for account
assert:
that:
- rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 10
- rl.resource_type == "instance"
- name: set instance limits for account idempotence
cs_resourcelimit:
type: instance
limit: 10
account: "{{ cs_resource_prefix }}_user"
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify set instance limits for account idempotence
assert:
that:
- not rl|changed
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.account == "{{ cs_resource_prefix }}_user"
- rl.limit == 10
- rl.resource_type == "instance"

View file

@ -0,0 +1,61 @@
---
- name: setup domain
cs_domain: path={{ cs_resource_prefix }}-domain
register: dom
- name: verify setup domain
assert:
that:
- dom|success
- name: setup 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"
domain: "{{ cs_resource_prefix }}-domain"
register: acc
- name: verify setup account
assert:
that:
- acc|success
- name: test failed unkonwn type
cs_resourcelimit:
type: unkonwn
limit: 20
domain: "{{ cs_resource_prefix }}-domain"
register: rl
ignore_errors: yes
- name: verify test failed unkonwn type
assert:
that:
- rl|failed
- name: test failed missing type
cs_resourcelimit:
register: rl
ignore_errors: yes
- name: verify test failed missing type
assert:
that:
- rl|failed
- name: setup resource limits domain
cs_resourcelimit:
type: instance
limit: 20
domain: "{{ cs_resource_prefix }}-domain"
register: rl
- name: verify setup resource limits domain
assert:
that:
- rl|success
- rl.domain == "{{ cs_resource_prefix }}-domain"
- rl.limit == 20
- include: instance.yml
- include: cpu.yml