diff options
Diffstat (limited to 'test/integration')
12 files changed, 176 insertions, 172 deletions
diff --git a/test/integration/targets/cs_instance/tasks/host.yml b/test/integration/targets/cs_instance/tasks/host.yml index c0614a1624..051448f264 100644 --- a/test/integration/targets/cs_instance/tasks/host.yml +++ b/test/integration/targets/cs_instance/tasks/host.yml @@ -13,11 +13,12 @@ state: stopped - name: setup zone facts - cs_zone_facts: + cs_zone_info: name: "{{ cs_common_zone_basic }}" + register: zone_info - name: setup find the host name - shell: cs listHosts type=routing zoneid="{{ cloudstack_zone.id }}" + shell: cs listHosts type=routing zoneid="{{ zone_info.zones[0].id }}" args: chdir: "{{ playbook_dir }}" register: host diff --git a/test/integration/targets/cs_instance/tasks/present.yml b/test/integration/targets/cs_instance/tasks/present.yml index 7edf54bed3..81b770331d 100644 --- a/test/integration/targets/cs_instance/tasks/present.yml +++ b/test/integration/targets/cs_instance/tasks/present.yml @@ -85,8 +85,8 @@ - instance.ssh_key == "{{ cs_resource_prefix }}-sshkey" - not instance.tags -- name: gather host facts of running instance - cs_instance_facts: +- name: gather host infos of running instance + cs_instance_info: name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}" - name: test running instance not updated in check mode diff --git a/test/integration/targets/cs_instance_facts/tasks/main.yml b/test/integration/targets/cs_instance_facts/tasks/main.yml deleted file mode 100644 index b7824f1b6a..0000000000 --- a/test/integration/targets/cs_instance_facts/tasks/main.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -- name: setup ssh key - cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey - register: sshkey -- name: verify setup ssh key - assert: - that: - - sshkey is successful - -- name: setup affinity group - cs_affinitygroup: name={{ cs_resource_prefix }}-ag - register: ag -- name: verify setup affinity group - assert: - that: - - ag is successful - -- name: setup security group - cs_securitygroup: name={{ cs_resource_prefix }}-sg - register: sg -- name: verify setup security group - assert: - that: - - sg is successful - -- 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 is successful - -- name: test instance facts in check mode - cs_instance_facts: - name: "{{ cs_resource_prefix }}-vm" - register: instance_facts - check_mode: true -- name: verify test instance facts in check mode - assert: - that: - - instance_facts is successful - - instance_facts is not changed - - instance_facts.id == instance.id - - instance_facts.domain == instance.domain - - instance_facts.account == instance.account - - instance_facts.zone == instance.zone - - instance_facts.name == instance.name - - instance_facts.service_offering == instance.service_offering - - instance_facts.host != "" - - 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 - -- name: test instance facts - cs_instance_facts: - name: "{{ cs_resource_prefix }}-vm" - register: instance_facts -- name: verify test instance facts - assert: - that: - - instance_facts is successful - - instance_facts is not changed - - instance_facts.id == instance.id - - instance_facts.domain == instance.domain - - instance_facts.account == instance.account - - instance_facts.zone == instance.zone - - instance_facts.name == instance.name - - instance_facts.service_offering == instance.service_offering - - instance_facts.host != "" - - 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 diff --git a/test/integration/targets/cs_instance_facts/aliases b/test/integration/targets/cs_instance_info/aliases index c89c86d7d2..c89c86d7d2 100644 --- a/test/integration/targets/cs_instance_facts/aliases +++ b/test/integration/targets/cs_instance_info/aliases diff --git a/test/integration/targets/cs_instance_facts/defaults/main.yml b/test/integration/targets/cs_instance_info/defaults/main.yml index 490c6c14e2..490c6c14e2 100644 --- a/test/integration/targets/cs_instance_facts/defaults/main.yml +++ b/test/integration/targets/cs_instance_info/defaults/main.yml diff --git a/test/integration/targets/cs_instance_facts/meta/main.yml b/test/integration/targets/cs_instance_info/meta/main.yml index e9a5b9eeae..e9a5b9eeae 100644 --- a/test/integration/targets/cs_instance_facts/meta/main.yml +++ b/test/integration/targets/cs_instance_info/meta/main.yml diff --git a/test/integration/targets/cs_instance_info/tasks/main.yml b/test/integration/targets/cs_instance_info/tasks/main.yml new file mode 100644 index 0000000000..d041ffe0d7 --- /dev/null +++ b/test/integration/targets/cs_instance_info/tasks/main.yml @@ -0,0 +1,91 @@ +--- +- name: setup ssh key + cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey + register: sshkey +- name: verify setup ssh key + assert: + that: + - sshkey is successful + +- name: setup affinity group + cs_affinitygroup: name={{ cs_resource_prefix }}-ag + register: ag +- name: verify setup affinity group + assert: + that: + - ag is successful + +- name: setup security group + cs_securitygroup: name={{ cs_resource_prefix }}-sg + register: sg +- name: verify setup security group + assert: + that: + - sg is successful + +- 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 is successful + +- name: test instance info in check mode + cs_instance_info: + name: "{{ cs_resource_prefix }}-vm" + register: instance_info + check_mode: true +- name: verify test instance info in check mode + assert: + that: + - instance_info is successful + - instance_info is not changed + - instance_info.instances[0].id == instance.id + - instance_info.instances[0].domain == instance.domain + - instance_info.instances[0].account == instance.account + - instance_info.instances[0].zone == instance.zone + - instance_info.instances[0].name == instance.name + - instance_info.instances[0].service_offering == instance.service_offering + - instance_info.instances[0].host != "" + +- name: test instance info + cs_instance_info: + name: "{{ cs_resource_prefix }}-vm" + register: instance_info +- name: verify test instance info + assert: + that: + - instance_info is successful + - instance_info is not changed + - instance_info.instances[0].id == instance.id + - instance_info.instances[0].domain == instance.domain + - instance_info.instances[0].account == instance.account + - instance_info.instances[0].zone == instance.zone + - instance_info.instances[0].name == instance.name + - instance_info.instances[0].service_offering == instance.service_offering + - instance_info.instances[0].host != "" + +- name: test instance info for all instances + cs_instance_info: + register: instance_info +- name: verify test instance info + assert: + that: + - instance_info is successful + - instance_info is not changed + - instance_info.instances | length > 0 + - '"id" in instance_info.instances[0]' + - '"domain" in instance_info.instances[0]' + - '"account" in instance_info.instances[0]' + - '"zone" in instance_info.instances[0]' + - '"name" in instance_info.instances[0]' + - '"service_offering" in instance_info.instances[0]' + - '"host" in instance_info.instances[0]' diff --git a/test/integration/targets/cs_volume/tasks/extract_upload.yml b/test/integration/targets/cs_volume/tasks/extract_upload.yml index d80bb02574..5dc701873b 100644 --- a/test/integration/targets/cs_volume/tasks/extract_upload.yml +++ b/test/integration/targets/cs_volume/tasks/extract_upload.yml @@ -52,11 +52,11 @@ - instance is successful - instance.state == 'Stopped' -- name: setup get instance facts - cs_instance_facts: +- name: setup get instance info + cs_instance_info: name: "{{ test_cs_instance_3 }}" register: instance -- name: verify setup get instance facts +- name: verify setup get instance info assert: that: - instance is successful @@ -65,7 +65,7 @@ cs_volume: zone: "{{ cs_common_zone_adv }}" state: extracted - name: "{{ instance.volumes[0].name }}" + name: "{{ instance.instances[0].volumes[0].name }}" check_mode: yes register: extracted_vol - name: verify test extract volume in check mode @@ -74,14 +74,14 @@ - extracted_vol is successful - extracted_vol is changed - extracted_vol.state == "Ready" - - extracted_vol.name == "{{ instance.volumes[0].name }}" + - extracted_vol.name == "{{ instance.instances[0].volumes[0].name }}" - extracted_vol.url is not defined - name: test extract volume cs_volume: zone: "{{ cs_common_zone_adv }}" state: extracted - name: "{{ instance.volumes[0].name }}" + name: "{{ instance.instances[0].volumes[0].name }}" register: extracted_vol - name: verify test extract volume assert: @@ -89,7 +89,7 @@ - extracted_vol is successful - extracted_vol is changed - extracted_vol.state == "DOWNLOAD_URL_CREATED" - - extracted_vol.name == "{{ instance.volumes[0].name }}" + - extracted_vol.name == "{{ instance.instances[0].volumes[0].name }}" - extracted_vol.url is defined - name: test upload volume with missing param diff --git a/test/integration/targets/cs_zone_facts/tasks/main.yml b/test/integration/targets/cs_zone_facts/tasks/main.yml deleted file mode 100644 index d275101724..0000000000 --- a/test/integration/targets/cs_zone_facts/tasks/main.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -- 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 is successful - -- name: get facts from zone in check mode - cs_zone_facts: - name: "{{ cs_resource_prefix }}-zone" - register: zone - check_mode: yes -- name: verify get facts from zone in check mode - assert: - that: - - zone is successful - - zone is not changed - - zone.dns1 == "8.8.8.8" - - zone.dns2 == "8.8.4.4" - - zone.internal_dns1 == "8.8.8.8" - - zone.internal_dns2 == "8.8.4.4" - - zone.local_storage_enabled == false - - zone.network_type == "Basic" - - zone.zone_token != "" - - zone.securitygroups_enabled == true - - zone.dhcp_provider == "VirtualRouter" - - zone.local_storage_enabled == false - # Ansible Facts - - cloudstack_zone.dns1 == "8.8.8.8" - - cloudstack_zone.dns2 == "8.8.4.4" - - cloudstack_zone.internal_dns1 == "8.8.8.8" - - cloudstack_zone.internal_dns2 == "8.8.4.4" - - cloudstack_zone.local_storage_enabled == false - - cloudstack_zone.network_type == "Basic" - - cloudstack_zone.zone_token != "" - - cloudstack_zone.securitygroups_enabled == true - - cloudstack_zone.dhcp_provider == "VirtualRouter" - - cloudstack_zone.local_storage_enabled == false - -- name: get facts from zone - cs_zone_facts: - name: "{{ cs_resource_prefix }}-zone" - register: zone -- name: verify get facts from zone - assert: - that: - - zone is successful - - zone is not changed - - zone.dns1 == "8.8.8.8" - - zone.dns2 == "8.8.4.4" - - zone.internal_dns1 == "8.8.8.8" - - zone.internal_dns2 == "8.8.4.4" - - zone.local_storage_enabled == false - - zone.network_type == "Basic" - - zone.zone_token != "" - - zone.securitygroups_enabled == true - - zone.dhcp_provider == "VirtualRouter" - - zone.local_storage_enabled == false - # Ansible Facts - - cloudstack_zone.dns1 == "8.8.8.8" - - cloudstack_zone.dns2 == "8.8.4.4" - - cloudstack_zone.internal_dns1 == "8.8.8.8" - - cloudstack_zone.internal_dns2 == "8.8.4.4" - - cloudstack_zone.local_storage_enabled == false - - cloudstack_zone.network_type == "Basic" - - cloudstack_zone.zone_token != "" - - cloudstack_zone.securitygroups_enabled == true - - cloudstack_zone.dhcp_provider == "VirtualRouter" - - cloudstack_zone.local_storage_enabled == false diff --git a/test/integration/targets/cs_zone_facts/aliases b/test/integration/targets/cs_zone_info/aliases index c89c86d7d2..c89c86d7d2 100644 --- a/test/integration/targets/cs_zone_facts/aliases +++ b/test/integration/targets/cs_zone_info/aliases diff --git a/test/integration/targets/cs_zone_facts/meta/main.yml b/test/integration/targets/cs_zone_info/meta/main.yml index e9a5b9eeae..e9a5b9eeae 100644 --- a/test/integration/targets/cs_zone_facts/meta/main.yml +++ b/test/integration/targets/cs_zone_info/meta/main.yml diff --git a/test/integration/targets/cs_zone_info/tasks/main.yml b/test/integration/targets/cs_zone_info/tasks/main.yml new file mode 100644 index 0000000000..74dccf8062 --- /dev/null +++ b/test/integration/targets/cs_zone_info/tasks/main.yml @@ -0,0 +1,73 @@ +--- +- 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 is successful + +- name: get info from zone in check mode + cs_zone_info: + name: "{{ cs_resource_prefix }}-zone" + register: zone + check_mode: yes +- name: verify get info from zone in check mode + assert: + that: + - zone is successful + - zone is not changed + - zone.zones[0].dns1 == "8.8.8.8" + - zone.zones[0].dns2 == "8.8.4.4" + - zone.zones[0].internal_dns1 == "8.8.8.8" + - zone.zones[0].internal_dns2 == "8.8.4.4" + - zone.zones[0].local_storage_enabled == false + - zone.zones[0].network_type == "Basic" + - zone.zones[0].zone_token != "" + - zone.zones[0].securitygroups_enabled == true + - zone.zones[0].dhcp_provider == "VirtualRouter" + - zone.zones[0].local_storage_enabled == false + +- name: get info from zone + cs_zone_info: + name: "{{ cs_resource_prefix }}-zone" + register: zone +- name: verify get info from zone + assert: + that: + - zone is successful + - zone is not changed + - zone.zones[0].dns1 == "8.8.8.8" + - zone.zones[0].dns2 == "8.8.4.4" + - zone.zones[0].internal_dns1 == "8.8.8.8" + - zone.zones[0].internal_dns2 == "8.8.4.4" + - zone.zones[0].local_storage_enabled == false + - zone.zones[0].network_type == "Basic" + - zone.zones[0].zone_token != "" + - zone.zones[0].securitygroups_enabled == true + - zone.zones[0].dhcp_provider == "VirtualRouter" + - zone.zones[0].local_storage_enabled == false + +- name: get info from all zones + cs_zone_info: + register: zones +- name: verify get info from all zones + assert: + that: + - zones is successful + - zones is not changed + - zones.zones | length > 0 + - '"dns1" in zone.zones[0]' + - '"dns2" in zone.zones[0]' + - '"internal_dns1" in zone.zones[0]' + - '"internal_dns2" in zone.zones[0]' + - '"local_storage_enabled" in zone.zones[0]' + - '"network_type" in zone.zones[0]' + - '"zone_token" in zone.zones[0]' + - '"securitygroups_enabled" in zone.zones[0]' + - '"dhcp_provider" in zone.zones[0]' + - '"local_storage_enabled" in zone.zones[0]' |