From 5c8168ae40b5a15b4a7aeb066735ff76c7c1a1bd Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sat, 15 Aug 2020 23:44:20 +0200 Subject: [PATCH] fix tests --- .github/workflows/integration.yml | 1 + .github/workflows/sanity.yml | 2 +- plugins/module_utils/cloudstack.py | 2 +- plugins/modules/cs_storage_pool.py | 14 -------------- plugins/modules/cs_vlan_ip_range.py | 2 ++ .../integration/targets/cs_cluster/tasks/main.yml | 3 +++ .../targets/cs_storage_pool/tasks/main.yml | 2 +- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1fc08557..731f4f61 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -4,6 +4,7 @@ on: push: branches: - master + pull_request: schedule: - cron: 30 6 * * * diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 6e1522d2..d6009b4e 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -28,4 +28,4 @@ jobs: run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - name: Run sanity tests - run: ansible-test sanity --docker -v --color --python 3.6 + run: ansible-test sanity --docker -v --color diff --git a/plugins/module_utils/cloudstack.py b/plugins/module_utils/cloudstack.py index 4f72b75a..85a6fee4 100644 --- a/plugins/module_utils/cloudstack.py +++ b/plugins/module_utils/cloudstack.py @@ -378,7 +378,7 @@ def get_pod(self, key=None): pods = self.query_api('listPods', **args) if pods: return self._get_by_key(key, pods['pod'][0]) - self.module.fail_json(msg="Pod %s not found" % pod_name) + self.module.fail_json(msg="Pod %s not found in zone %s" % (self.module.params.get('pod'), self.get_zone(key='name'))) def get_ip_address(self, key=None): if self.ip_address: diff --git a/plugins/modules/cs_storage_pool.py b/plugins/modules/cs_storage_pool.py index e3ed58f4..e4034587 100644 --- a/plugins/modules/cs_storage_pool.py +++ b/plugins/modules/cs_storage_pool.py @@ -415,20 +415,6 @@ def get_storage_provider(self, type="primary"): return provider self.fail_json(msg="Storage provider %s not found" % provider) - def get_pod(self, key=None): - pod = self.module.params.get('pod') - if not pod: - return None - args = { - 'name': pod, - 'zoneid': self.get_zone(key='id'), - } - pods = self.query_api('listPods', **args) - if pods: - return self._get_by_key(key, pods['pod'][0]) - - self.fail_json(msg="Pod %s not found" % self.module.params.get('pod')) - def get_cluster(self, key=None): cluster = self.module.params.get('cluster') if not cluster: diff --git a/plugins/modules/cs_vlan_ip_range.py b/plugins/modules/cs_vlan_ip_range.py index 8d767378..aaca4158 100644 --- a/plugins/modules/cs_vlan_ip_range.py +++ b/plugins/modules/cs_vlan_ip_range.py @@ -77,6 +77,7 @@ description: - Name of the pod. type: str + version_added: 1.0.0 state: description: - State of the network ip range. @@ -109,6 +110,7 @@ VLAN range to the Physical Network with a Public traffic type. type: bool default: no + version_added: 1.0.0 for_system_vms: description: - C(yes) if IP range is set to system vms, C(no) if not diff --git a/tests/integration/targets/cs_cluster/tasks/main.yml b/tests/integration/targets/cs_cluster/tasks/main.yml index 59c1a2a0..4ba20d7b 100644 --- a/tests/integration/targets/cs_cluster/tasks/main.yml +++ b/tests/integration/targets/cs_cluster/tasks/main.yml @@ -63,6 +63,7 @@ cs_cluster: name: "{{ cs_resource_prefix }}-cluster" zone: "{{ cs_resource_prefix }}-zone" + pod: "{{ cs_resource_prefix }}-pod" hypervisor: Simulator cluster_type: CloudManaged register: cluster_origin @@ -77,6 +78,7 @@ cs_cluster: name: "{{ cs_resource_prefix }}-cluster" zone: "{{ cs_resource_prefix }}-zone" + pod: "{{ cs_resource_prefix }}-pod" hypervisor: Simulator cluster_type: CloudManaged register: cluster_origin @@ -95,6 +97,7 @@ cs_cluster: name: "{{ cs_resource_prefix }}-Cluster" zone: "{{ cs_resource_prefix }}-Zone" + pod: "{{ cs_resource_prefix }}-pod" hypervisor: Simulator cluster_type: CloudManaged register: cluster diff --git a/tests/integration/targets/cs_storage_pool/tasks/main.yml b/tests/integration/targets/cs_storage_pool/tasks/main.yml index bc623eec..a418b984 100644 --- a/tests/integration/targets/cs_storage_pool/tasks/main.yml +++ b/tests/integration/targets/cs_storage_pool/tasks/main.yml @@ -84,7 +84,7 @@ assert: that: - sp is failed - - "sp.msg == 'Pod DNE not found'" + - "'Pod DNE not found' in sp.msg" - name: create storage pool in check mode cs_storage_pool: