Skip to content

Commit

Permalink
azure_rm_aks: add a test for the minimal parameters cluster definition
Browse files Browse the repository at this point in the history
  • Loading branch information
geekq committed May 12, 2021
1 parent d561696 commit 88752ab
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions tests/integration/targets/azure_rm_aks/tasks/minimal-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
- set_fact:
rpfx: "{{ resource_group | hash('md5') | truncate(8, True, '') }}"
noderpfx: "{{ resource_group | hash('md5') | truncate(4, True, '') }}"

- name: Use minimal parameters and system-assigned identity
azure_rm_aks:
name: "minimal{{ rpfx }}"
location: eastus
resource_group: "{{ resource_group }}"
dns_prefix: "aks{{ rpfx }}"
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
register: output

- name: Assert the AKS instance is well created
assert:
that:
- output.changed
- output.provisioning_state == 'Succeeded'

- name: Get AKS fact
azure_rm_aks_info:
name: "minimal{{ rpfx }}"
resource_group: "{{ resource_group }}"
register: fact

- name: Assert fact returns the created one
assert:
that:
- "fact.aks | length == 1"
- fact.aks[0].id == output.id

- name: Use minimal parameters and system-assigned identity (idempotent)
azure_rm_aks:
name: "minimal{{ rpfx }}"
location: eastus
resource_group: "{{ resource_group }}"
dns_prefix: "aks{{ rpfx }}"
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
register: output

- name: Assert idempotent
assert:
that:
- not output.changed

- name: Delete the AKS instance
azure_rm_aks:
name: "minimal{{ rpfx }}"
resource_group: "{{ resource_group }}"
state: absent
register: output

- name: Assert the AKS instance is well deleted
assert:
that:
- output.changed

- name: Get AKS fact
azure_rm_aks_info:
name: "minimal{{ rpfx }}"
resource_group: "{{ resource_group }}"
register: fact

- name: Assert fact returns empty
assert:
that:
- "fact.aks | length == 0"

0 comments on commit 88752ab

Please sign in to comment.