diff options
author | René Moser <mail@renemoser.net> | 2017-05-26 12:19:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-26 12:19:47 +0200 |
commit | d5b04aa1f16bfef43799a89c57d3bcfa8bcfbd40 (patch) | |
tree | 83b1600c7e609e903417bcd1df3f4df7e647637e /test/integration/targets/cs_resourcelimit | |
parent | 2af5556901f0847d835af60f58769a8dd94c4415 (diff) | |
download | ansible-d5b04aa1f16bfef43799a89c57d3bcfa8bcfbd40.tar.gz |
cloudstack: add check mode tests (#24908)
* cloudstack: test: cs_network_acl: add check_mode tests
* cloudstack: test: cs_pod: add check_mode tests
* cloudstack: test: cs_user: add check_mode tests
* cloudstack: test: cs_sshkeypair: add check_mode tests
* cloudstack: test: cs_project: add check_mode tests
* cloudstack: test: cs_vpc: add check_mode tests
* cloudstack: test: cs_vpn_gateway: add check_mode tests
* cloudstack: test: cs_volume: add check_mode tests
* cloudstack: test: cs_vmsnapshot: add check_mode tests
* cloudstack: test: cs_account: add check_mode tests
* cloudstack: test: cs_affinitygroup: add check_mode tests
* cloudstack: test: cs_cluster: add check_mode tests
* cloudstack: test: cs_domain: add check_mode tests
* cloudstack: test: cs_instancegroup: add check_mode tests
* cloudstack: test: cs_iso: add check_mode tests
* cloudstack: test: cs_loadbalancer_rule: add check_mode tests
* cloudstack: test: cs_portforward: add check_mode tests
* cloudstack: test: cs_resourcelimit: add check_mode tests
* cloudstack: test: cs_securitygroup: add check_mode tests
* cloudstack: test: cs_securitygroup_rule: add check_mode tests
* cloudstack: test: cs_configuration: add check_mode tests
* cloudstack: test: cs_firewall: add check_mode tests
* cloudstack: test: cs_instance: add check_mode tests
* cloudstack: query current tags from API
Fixes unexpected tags returned in check mode.
Diffstat (limited to 'test/integration/targets/cs_resourcelimit')
3 files changed, 122 insertions, 1 deletions
diff --git a/test/integration/targets/cs_resourcelimit/tasks/cpu.yml b/test/integration/targets/cs_resourcelimit/tasks/cpu.yml index 5faa6a9233..028dcb3e8a 100644 --- a/test/integration/targets/cs_resourcelimit/tasks/cpu.yml +++ b/test/integration/targets/cs_resourcelimit/tasks/cpu.yml @@ -15,6 +15,35 @@ - rl.limit == 20 - rl.resource_type == "cpu" +- name: setup cpu limits for domain + cs_resourcelimit: + type: cpu + limit: -1 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup cpu limits for domain + assert: + that: + - rl|success + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == -1 + - rl.resource_type == "cpu" + +- name: set cpu limits for domain in check mode + cs_resourcelimit: + type: cpu + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set cpu limits for domain in check mode + assert: + that: + - rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == -1 + - rl.resource_type == "cpu" + - name: set cpu limits for domain cs_resourcelimit: type: cpu @@ -43,6 +72,23 @@ - rl.limit == 12 - rl.resource_type == "cpu" +- name: set cpu limits for account in check mode + cs_resourcelimit: + type: cpu + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set cpu limits for account in check mode + assert: + that: + - rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.account == "{{ cs_resource_prefix }}_user" + - rl.limit == 20 + - rl.resource_type == "cpu" + - name: set cpu limits for account cs_resourcelimit: type: cpu diff --git a/test/integration/targets/cs_resourcelimit/tasks/instance.yml b/test/integration/targets/cs_resourcelimit/tasks/instance.yml index 9fea9a3545..2665f75a68 100644 --- a/test/integration/targets/cs_resourcelimit/tasks/instance.yml +++ b/test/integration/targets/cs_resourcelimit/tasks/instance.yml @@ -15,6 +15,21 @@ - rl.limit == 20 - rl.resource_type == "instance" +- name: set instance limits for domain in check mode + cs_resourcelimit: + type: instance + limit: 12 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set instance limits for domain in check mode + assert: + that: + - rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 20 + - rl.resource_type == "instance" + - name: set instance limits for domain cs_resourcelimit: type: instance @@ -43,6 +58,23 @@ - rl.limit == 12 - rl.resource_type == "instance" +- name: set instance limits for account in check mode + cs_resourcelimit: + type: instance + limit: 10 + account: "{{ cs_resource_prefix }}_user" + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify set instance limits for account in check mode + 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 cs_resourcelimit: type: instance diff --git a/test/integration/targets/cs_resourcelimit/tasks/main.yml b/test/integration/targets/cs_resourcelimit/tasks/main.yml index f662bb939a..3c77c96438 100644 --- a/test/integration/targets/cs_resourcelimit/tasks/main.yml +++ b/test/integration/targets/cs_resourcelimit/tasks/main.yml @@ -47,7 +47,7 @@ - name: setup resource limits domain cs_resourcelimit: type: instance - limit: 20 + limit: 10 domain: "{{ cs_resource_prefix }}-domain" register: rl - name: verify setup resource limits domain @@ -55,6 +55,49 @@ that: - rl|success - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 10 + +- name: set resource limits domain to 20 in check mode + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl + check_mode: true +- name: verify setup resource limits domain to 20 in check mode + assert: + that: + - rl|success + - rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 10 + +- name: set resource limits domain to 20 + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup resource limits domain to 20 + assert: + that: + - rl|success + - rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" + - rl.limit == 20 + +- name: set resource limits domain to 20 idempotence + cs_resourcelimit: + type: instance + limit: 20 + domain: "{{ cs_resource_prefix }}-domain" + register: rl +- name: verify setup resource limits domain to 20 idempotence + assert: + that: + - rl|success + - not rl|changed + - rl.domain == "{{ cs_resource_prefix }}-domain" - rl.limit == 20 - include: instance.yml |