mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #14275 from resmo/tests/new-modules-2.1
[2.1] cloudstack: integration tests for new modules
This commit is contained in:
commit
c5fa51a7ac
19 changed files with 1115 additions and 0 deletions
|
@ -23,3 +23,8 @@
|
|||
- { role: test_cs_firewall, tags: test_cs_firewall }
|
||||
- { role: test_cs_loadbalancer_rule, tags: test_cs_loadbalancer_rule }
|
||||
- { role: test_cs_volume, tags: test_cs_volume }
|
||||
- { role: test_cs_instance_facts, tags: test_cs_instance_facts }
|
||||
- { 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 }
|
||||
|
|
3
test/integration/roles/test_cs_cluster/meta/main.yml
Normal file
3
test/integration/roles/test_cs_cluster/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
211
test/integration/roles/test_cs_cluster/tasks/main.yml
Normal file
211
test/integration/roles/test_cs_cluster/tasks/main.yml
Normal file
|
@ -0,0 +1,211 @@
|
|||
---
|
||||
- name: setup cluster is absent
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: absent
|
||||
register: cluster
|
||||
- name: verify setup cluster is absent
|
||||
assert:
|
||||
that:
|
||||
- cluster|success
|
||||
|
||||
- name: setup zone is present
|
||||
cs_zone:
|
||||
name: "{{ cs_resource_prefix }}-zone"
|
||||
dns1: 8.8.8.8
|
||||
dns2: 8.8.4.4
|
||||
network_type: basic
|
||||
register: zone
|
||||
- name: verify setup zone is present
|
||||
assert:
|
||||
that:
|
||||
- zone|success
|
||||
|
||||
- name: setup pod is preset
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.101
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify setup pod is preset
|
||||
assert:
|
||||
that:
|
||||
- pod|success
|
||||
|
||||
- name: test fail if missing name
|
||||
cs_cluster:
|
||||
register: cluster
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing name
|
||||
assert:
|
||||
that:
|
||||
- cluster|failed
|
||||
- "cluster.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test create cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
hypervisor: simulator
|
||||
cluster_type: CloudManaged
|
||||
register: cluster_origin
|
||||
tags: disable
|
||||
- name: verify test create cluster
|
||||
assert:
|
||||
that:
|
||||
- cluster_origin|changed
|
||||
- cluster_origin.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster_origin.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster_origin.allocation_state == "Enabled"
|
||||
- cluster_origin.hypervisor == "Simulator"
|
||||
- cluster_origin.cluster_type == "CloudManaged"
|
||||
|
||||
- name: test create cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-Cluster"
|
||||
zone: "{{ cs_resource_prefix }}-Zone"
|
||||
hypervisor: Simulator
|
||||
cluster_type: CloudManaged
|
||||
register: cluster
|
||||
- name: verify test create cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- cluster.id == cluster_origin.id
|
||||
- not cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster_origin.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "CloudManaged"
|
||||
|
||||
- name: test update cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
hypervisor: simulator
|
||||
cluster_type: ExternalManaged
|
||||
register: cluster
|
||||
- name: verify test update cluster
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test update cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
hypervisor: simulator
|
||||
cluster_type: ExternalManaged
|
||||
register: cluster
|
||||
- name: verify test update cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- not cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test disable cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: disabled
|
||||
register: cluster
|
||||
tags: disable
|
||||
- name: verify test disable cluster
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Disabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
tags: disable
|
||||
|
||||
- name: test disable cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: disabled
|
||||
register: cluster
|
||||
tags: disable
|
||||
- name: verify test disable cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- not cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Disabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
tags: disable
|
||||
|
||||
- name: test enable cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: enabled
|
||||
register: cluster
|
||||
- name: verify test enable cluster
|
||||
assert:
|
||||
that:
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test enable cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
state: enabled
|
||||
register: cluster
|
||||
- name: verify test enable cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- not cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster.hypervisor == "Simulator"
|
||||
- cluster.cluster_type == "ExternalManaged"
|
||||
- cluster.id == cluster_origin.id
|
||||
|
||||
- name: test remove cluster
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: cluster
|
||||
- name: verify test remove cluster
|
||||
assert:
|
||||
that:
|
||||
- cluster.id == cluster_origin.id
|
||||
- cluster|changed
|
||||
- cluster.name == "{{ cs_resource_prefix }}-cluster"
|
||||
- cluster.zone == "{{ cs_resource_prefix }}-zone"
|
||||
- cluster.allocation_state == "Enabled"
|
||||
- cluster_origin.hypervisor == "Simulator"
|
||||
|
||||
- name: test remove cluster idempotence
|
||||
cs_cluster:
|
||||
name: "{{ cs_resource_prefix }}-cluster"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: cluster
|
||||
- name: verify test remove cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- not cluster|changed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
test_cs_configuration_storage: PS0
|
||||
test_cs_configuration_cluster: C0
|
||||
test_cs_configuration_account: admin
|
||||
test_cs_configuration_zone: Sandbox-simulator
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: test configuration account
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: true
|
||||
register: config
|
||||
- name: verify test configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration account
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify update configuration account
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "allow.public.user.templates"
|
||||
- config.scope == "account"
|
||||
- config.account == "{{ test_cs_configuration_account }}"
|
||||
|
||||
- name: test update configuration account idempotence
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify update configuration account idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "allow.public.user.templates"
|
||||
- config.scope == "account"
|
||||
- config.account == "{{ test_cs_configuration_account }}"
|
||||
|
||||
- name: test reset configuration account
|
||||
cs_configuration:
|
||||
name: allow.public.user.templates
|
||||
account: "{{ test_cs_configuration_account }}"
|
||||
value: true
|
||||
register: config
|
||||
- name: verify update configuration account
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "allow.public.user.templates"
|
||||
- config.scope == "account"
|
||||
- config.account == "{{ test_cs_configuration_account }}"
|
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: test configuration cluster
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 1.0
|
||||
register: config
|
||||
- name: verify test configuration cluster
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration cluster
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
- name: verify update configuration cluster
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "2.0"
|
||||
- config.name == "cpu.overprovisioning.factor"
|
||||
- config.scope == "cluster"
|
||||
- config.cluster == "{{ test_cs_configuration_cluster }}"
|
||||
|
||||
- name: test update configuration cluster idempotence
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
- name: verify update configuration cluster idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "2.0"
|
||||
- config.name == "cpu.overprovisioning.factor"
|
||||
- config.scope == "cluster"
|
||||
- config.cluster == "{{ test_cs_configuration_cluster }}"
|
||||
|
||||
- name: test reset configuration cluster
|
||||
cs_configuration:
|
||||
name: cpu.overprovisioning.factor
|
||||
cluster: "{{ test_cs_configuration_cluster }}"
|
||||
value: 1.0
|
||||
register: config
|
||||
- name: verify reset configuration cluster
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "1.0"
|
||||
- config.name == "cpu.overprovisioning.factor"
|
||||
- config.scope == "cluster"
|
||||
- config.cluster == "{{ test_cs_configuration_cluster }}"
|
162
test/integration/roles/test_cs_configuration/tasks/main.yml
Normal file
162
test/integration/roles/test_cs_configuration/tasks/main.yml
Normal file
|
@ -0,0 +1,162 @@
|
|||
---
|
||||
- name: test fail if missing name
|
||||
cs_configuration:
|
||||
register: config
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing arguments
|
||||
assert:
|
||||
that:
|
||||
- config|failed
|
||||
- "config.msg == 'missing required arguments: value,name'"
|
||||
|
||||
- name: test configuration
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: global
|
||||
register: config
|
||||
- name: verify test configuration
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration string
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: all
|
||||
register: config
|
||||
- name: verify test update configuration string
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "all"
|
||||
- config.name == "network.loadbalancer.haproxy.stats.visibility"
|
||||
|
||||
- name: test update configuration string idempotence
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: all
|
||||
register: config
|
||||
- name: verify test update configuration string idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "all"
|
||||
- config.name == "network.loadbalancer.haproxy.stats.visibility"
|
||||
|
||||
- name: test reset configuration string
|
||||
cs_configuration:
|
||||
name: network.loadbalancer.haproxy.stats.visibility
|
||||
value: global
|
||||
register: config
|
||||
- name: verify test reset configuration string
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "global"
|
||||
- config.name == "network.loadbalancer.haproxy.stats.visibility"
|
||||
|
||||
- name: test configuration
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
value: false
|
||||
register: config
|
||||
- name: verify test configuration
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration bool
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
value: true
|
||||
register: config
|
||||
- name: verify test update configuration bool
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "vmware.recycle.hung.wokervm"
|
||||
|
||||
- name: test update configuration bool idempotence
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
value: true
|
||||
register: config
|
||||
- name: verify test update configuration bool idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "vmware.recycle.hung.wokervm"
|
||||
|
||||
- name: test reset configuration bool
|
||||
cs_configuration:
|
||||
name: vmware.recycle.hung.wokervm
|
||||
value: false
|
||||
register: config
|
||||
- name: verify test reset configuration bool
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "vmware.recycle.hung.wokervm"
|
||||
|
||||
- name: test configuration
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.7
|
||||
register: config
|
||||
- name: verify test configuration
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration float
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.81
|
||||
register: config
|
||||
- name: verify update configuration float
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "0.81"
|
||||
- config.name == "agent.load.threshold"
|
||||
|
||||
- name: test update configuration float idempotence
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.81
|
||||
register: config
|
||||
- name: verify update configuration float idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "0.81"
|
||||
- config.name == "agent.load.threshold"
|
||||
|
||||
- name: reset configuration float
|
||||
cs_configuration:
|
||||
name: agent.load.threshold
|
||||
value: 0.7
|
||||
register: config
|
||||
- name: verify reset configuration float
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "0.7"
|
||||
- config.name == "agent.load.threshold"
|
||||
|
||||
- include: storage.yml
|
||||
- include: account.yml
|
||||
- include: zone.yml
|
||||
- include: cluster.yml
|
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: test configuration storage
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
- name: verify test configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration storage
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 3.0
|
||||
register: config
|
||||
- name: verify update configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "3.0"
|
||||
- config.name == "storage.overprovisioning.factor"
|
||||
- config.scope == "storagepool"
|
||||
- config.storage == "{{ test_cs_configuration_storage }}"
|
||||
|
||||
- name: test update configuration storage idempotence
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 3.0
|
||||
register: config
|
||||
- name: verify update configuration storage idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "3.0"
|
||||
- config.name == "storage.overprovisioning.factor"
|
||||
- config.scope == "storagepool"
|
||||
- config.storage == "{{ test_cs_configuration_storage }}"
|
||||
|
||||
- name: test reset configuration storage
|
||||
cs_configuration:
|
||||
name: storage.overprovisioning.factor
|
||||
storage: "{{ test_cs_configuration_storage }}"
|
||||
value: 2.0
|
||||
register: config
|
||||
- name: verify reset configuration storage
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "2.0"
|
||||
- config.name == "storage.overprovisioning.factor"
|
||||
- config.scope == "storagepool"
|
||||
- config.storage == "{{ test_cs_configuration_storage }}"
|
59
test/integration/roles/test_cs_configuration/tasks/zone.yml
Normal file
59
test/integration/roles/test_cs_configuration/tasks/zone.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: test configuration zone
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify test configuration zone
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
|
||||
- name: test update configuration zone
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: true
|
||||
register: config
|
||||
- name: verify update configuration zone
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "use.external.dns"
|
||||
- config.scope == "zone"
|
||||
- config.zone == "{{ test_cs_configuration_zone }}"
|
||||
|
||||
- name: test update configuration zone idempotence
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: true
|
||||
register: config
|
||||
- name: verify update configuration zone idempotence
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- not config|changed
|
||||
- config.value == "true"
|
||||
- config.name == "use.external.dns"
|
||||
- config.scope == "zone"
|
||||
- config.zone == "{{ test_cs_configuration_zone }}"
|
||||
|
||||
- name: test reset configuration zone
|
||||
cs_configuration:
|
||||
name: use.external.dns
|
||||
zone: "{{ test_cs_configuration_zone }}"
|
||||
value: false
|
||||
register: config
|
||||
- name: verify reset configuration zone
|
||||
assert:
|
||||
that:
|
||||
- config|success
|
||||
- config|changed
|
||||
- config.value == "false"
|
||||
- config.name == "use.external.dns"
|
||||
- config.scope == "zone"
|
||||
- config.zone == "{{ test_cs_configuration_zone }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
55
test/integration/roles/test_cs_instance_facts/tasks/main.yml
Normal file
55
test/integration/roles/test_cs_instance_facts/tasks/main.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
- name: setup ssh key
|
||||
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
|
||||
register: sshkey
|
||||
- name: verify setup ssh key
|
||||
assert:
|
||||
that:
|
||||
- sshkey|success
|
||||
|
||||
- name: setup affinity group
|
||||
cs_affinitygroup: name={{ cs_resource_prefix }}-ag
|
||||
register: ag
|
||||
- name: verify setup affinity group
|
||||
assert:
|
||||
that:
|
||||
- ag|success
|
||||
|
||||
- name: setup security group
|
||||
cs_securitygroup: name={{ cs_resource_prefix }}-sg
|
||||
register: sg
|
||||
- name: verify setup security group
|
||||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
|
||||
- name: setup instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
affinity_group: "{{ cs_resource_prefix }}-ag"
|
||||
security_group: "{{ cs_resource_prefix }}-sg"
|
||||
ssh_key: "{{ cs_resource_prefix }}-sshkey"
|
||||
tags: []
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: test instance facts
|
||||
cs_instance_facts:
|
||||
name: "{{ cs_resource_prefix }}-vm"
|
||||
register: instance_facts
|
||||
- name: verify test instance facts
|
||||
assert:
|
||||
that:
|
||||
- instance_facts|success
|
||||
- not instance_facts|changed
|
||||
- cloudstack_instance.id == instance.id
|
||||
- cloudstack_instance.domain == instance.domain
|
||||
- cloudstack_instance.account == instance.account
|
||||
- cloudstack_instance.zone == instance.zone
|
||||
- cloudstack_instance.name == instance.name
|
||||
- cloudstack_instance.service_offering == instance.service_offering
|
3
test/integration/roles/test_cs_pod/meta/main.yml
Normal file
3
test/integration/roles/test_cs_pod/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
210
test/integration/roles/test_cs_pod/tasks/main.yml
Normal file
210
test/integration/roles/test_cs_pod/tasks/main.yml
Normal file
|
@ -0,0 +1,210 @@
|
|||
---
|
||||
- name: setup pod is absent
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
state: absent
|
||||
register: pod
|
||||
- name: verify setup pod is absent
|
||||
assert:
|
||||
that:
|
||||
- pod|success
|
||||
|
||||
- name: setup zone is present
|
||||
cs_zone:
|
||||
name: "{{ cs_resource_prefix }}-zone"
|
||||
dns1: 8.8.8.8
|
||||
dns2: 8.8.4.4
|
||||
network_type: basic
|
||||
register: zone
|
||||
- name: verify setup zone is present
|
||||
assert:
|
||||
that:
|
||||
- zone|success
|
||||
|
||||
- name: test fail if missing name
|
||||
cs_pod:
|
||||
register: pod
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing name
|
||||
assert:
|
||||
that:
|
||||
- pod|failed
|
||||
- "pod.msg == 'missing required arguments: name'"
|
||||
|
||||
- name: test create pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.101
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod_origin
|
||||
- name: verify test create pod
|
||||
assert:
|
||||
that:
|
||||
- pod_origin|changed
|
||||
- pod_origin.allocation_state == "Enabled"
|
||||
- pod_origin.start_ip == "10.100.10.101"
|
||||
- pod_origin.end_ip == "10.100.10.254"
|
||||
- pod_origin.gateway == "10.100.10.1"
|
||||
- pod_origin.netmask == "255.255.255.0"
|
||||
- pod_origin.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test create pod idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.101
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify test create pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.101"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test update pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.102
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify test update pod
|
||||
assert:
|
||||
that:
|
||||
- pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test update pod idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
start_ip: 10.100.10.102
|
||||
gateway: 10.100.10.1
|
||||
netmask: 255.255.255.0
|
||||
register: pod
|
||||
- name: verify test update pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test disable pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: disabled
|
||||
register: pod
|
||||
- name: verify test enable pod
|
||||
assert:
|
||||
that:
|
||||
- pod|changed
|
||||
- pod.allocation_state == "Disabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test disable pod idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: disabled
|
||||
register: pod
|
||||
- name: verify test enable pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Disabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test enable pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: enabled
|
||||
register: pod
|
||||
- name: verify test disable pod
|
||||
assert:
|
||||
that:
|
||||
- pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
|
||||
- name: test enable pod idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: enabled
|
||||
register: pod
|
||||
- name: verify test enabled pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.id == pod_origin.id
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test absent pod
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: pod
|
||||
- name: verify test create pod
|
||||
assert:
|
||||
that:
|
||||
- pod|changed
|
||||
- pod.id == pod_origin.id
|
||||
- pod.allocation_state == "Enabled"
|
||||
- pod.start_ip == "10.100.10.102"
|
||||
- pod.end_ip == "10.100.10.254"
|
||||
- pod.gateway == "10.100.10.1"
|
||||
- pod.netmask == "255.255.255.0"
|
||||
- pod.zone == "{{ cs_resource_prefix }}-zone"
|
||||
|
||||
- name: test absent pod idempotence
|
||||
cs_pod:
|
||||
name: "{{ cs_resource_prefix }}-pod"
|
||||
zone: "{{ cs_resource_prefix }}-zone"
|
||||
state: absent
|
||||
register: pod
|
||||
- name: verify test absent pod idempotence
|
||||
assert:
|
||||
that:
|
||||
- not pod|changed
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
76
test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml
Normal file
76
test/integration/roles/test_cs_resourcelimit/tasks/cpu.yml
Normal 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"
|
|
@ -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"
|
61
test/integration/roles/test_cs_resourcelimit/tasks/main.yml
Normal file
61
test/integration/roles/test_cs_resourcelimit/tasks/main.yml
Normal 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
|
Loading…
Reference in a new issue