From 5d5d905e36dd9e9be7cc4eabb859df77e3e50f6e Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Tue, 2 Feb 2016 20:21:30 +0100 Subject: [PATCH] cloudstack: new integration tests test_cs_resourcelimit --- test/integration/cloudstack.yml | 1 + .../roles/test_cs_resourcelimit/meta/main.yml | 3 + .../roles/test_cs_resourcelimit/tasks/cpu.yml | 76 +++++++++++++++++++ .../test_cs_resourcelimit/tasks/instance.yml | 76 +++++++++++++++++++ .../test_cs_resourcelimit/tasks/main.yml | 61 +++++++++++++++ 5 files changed, 217 insertions(+) create mode 100644 test/integration/roles/test_cs_resourcelimit/meta/main.yml create mode 100644 test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml create mode 100644 test/integration/roles/test_cs_resourcelimit/tasks/instance.yml create mode 100644 test/integration/roles/test_cs_resourcelimit/tasks/main.yml diff --git a/test/integration/cloudstack.yml b/test/integration/cloudstack.yml index 99d08bb0cf..9104237bfd 100644 --- a/test/integration/cloudstack.yml +++ b/test/integration/cloudstack.yml @@ -27,3 +27,4 @@ - { role: test_cs_configuration, tags: test_cs_configuration } - { role: test_cs_pod, tags: test_cs_pod } - { role: test_cs_cluster, tags: test_cs_cluster } + - { role: test_cs_resourcelimit, tags: test_cs_resourcelimit } diff --git a/test/integration/roles/test_cs_resourcelimit/meta/main.yml b/test/integration/roles/test_cs_resourcelimit/meta/main.yml new file mode 100644 index 0000000000..03e38bd4f7 --- /dev/null +++ b/test/integration/roles/test_cs_resourcelimit/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - test_cs_common diff --git a/test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml b/test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml new file mode 100644 index 0000000000..5faa6a9233 --- /dev/null +++ b/test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml @@ -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" diff --git a/test/integration/roles/test_cs_resourcelimit/tasks/instance.yml b/test/integration/roles/test_cs_resourcelimit/tasks/instance.yml new file mode 100644 index 0000000000..9fea9a3545 --- /dev/null +++ b/test/integration/roles/test_cs_resourcelimit/tasks/instance.yml @@ -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" diff --git a/test/integration/roles/test_cs_resourcelimit/tasks/main.yml b/test/integration/roles/test_cs_resourcelimit/tasks/main.yml new file mode 100644 index 0000000000..f662bb939a --- /dev/null +++ b/test/integration/roles/test_cs_resourcelimit/tasks/main.yml @@ -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