add resource group test (#55688)
This commit is contained in:
parent
204db4d044
commit
0d3d002505
4 changed files with 49 additions and 1 deletions
|
@ -145,7 +145,8 @@ class AzureRMResourceGroupFacts(AzureRMModuleBase):
|
||||||
|
|
||||||
self.results = dict(
|
self.results = dict(
|
||||||
changed=False,
|
changed=False,
|
||||||
ansible_facts=dict(azure_resourcegroups=[])
|
ansible_facts=dict(azure_resourcegroups=[]),
|
||||||
|
resourcegroups=[]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = None
|
self.name = None
|
||||||
|
@ -170,6 +171,8 @@ class AzureRMResourceGroupFacts(AzureRMModuleBase):
|
||||||
for item in self.results['ansible_facts']['azure_resourcegroups']:
|
for item in self.results['ansible_facts']['azure_resourcegroups']:
|
||||||
item['resources'] = self.list_by_rg(item['name'])
|
item['resources'] = self.list_by_rg(item['name'])
|
||||||
|
|
||||||
|
self.results['resourcegroups'] = self.results['ansible_facts']['azure_resourcegroups']
|
||||||
|
|
||||||
return self.results
|
return self.results
|
||||||
|
|
||||||
def get_item(self):
|
def get_item(self):
|
||||||
|
|
4
test/integration/targets/azure_rm_resourcegroup/aliases
Normal file
4
test/integration/targets/azure_rm_resourcegroup/aliases
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
cloud/azure
|
||||||
|
shippable/azure/group3
|
||||||
|
destructive
|
||||||
|
azure_rm_resourcegroup_facts
|
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_azure
|
|
@ -0,0 +1,39 @@
|
||||||
|
- name: Get resource group facts
|
||||||
|
azure_rm_resourcegroup_facts:
|
||||||
|
register: rg
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- rg.resourcegroups | length >= 1
|
||||||
|
|
||||||
|
- name: Get resource group facts
|
||||||
|
azure_rm_resourcegroup_facts:
|
||||||
|
name: "{{ resource_group }}"
|
||||||
|
list_resources: yes
|
||||||
|
register: rg
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- rg.resourcegroups | length == 1
|
||||||
|
- rg.resourcegroups[0].resources | length >= 0
|
||||||
|
|
||||||
|
- name: Create resource group (idempontent)
|
||||||
|
azure_rm_resourcegroup:
|
||||||
|
name: "{{ resource_group }}"
|
||||||
|
location: "{{ rg.resourcegroups[0].location }}"
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- not output.changed
|
||||||
|
|
||||||
|
- name: delete resource group
|
||||||
|
azure_rm_resourcegroup:
|
||||||
|
name: "{{ resource_group }}"
|
||||||
|
state: absent
|
||||||
|
check_mode: yes
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output.changed
|
Loading…
Reference in a new issue