mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 12:03:58 -07:00
Clean up and migrate Azure tests. (#28103)
* Remove placeholder Azure test. * Migrate Azure tests to ansible-test. * Initial cleanup on remaining legacy Azure tests.
This commit is contained in:
parent
ac56a2f138
commit
3631163329
23 changed files with 264 additions and 638 deletions
2
test/integration/targets/azure_rm_storageaccount/aliases
Normal file
2
test/integration/targets/azure_rm_storageaccount/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
cloud/azure
|
||||
destructive
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_azure
|
122
test/integration/targets/azure_rm_storageaccount/tasks/main.yml
Normal file
122
test/integration/targets/azure_rm_storageaccount/tasks/main.yml
Normal file
|
@ -0,0 +1,122 @@
|
|||
- name: Create storage account name
|
||||
set_fact:
|
||||
storage_account: "{{ resource_group | hash('md5') | truncate(24, True, '') }}"
|
||||
|
||||
- name: Test invalid account name
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "invalid_char$"
|
||||
state: present
|
||||
register: invalid_name
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Assert task failed
|
||||
assert: { that: "invalid_name['failed'] == True" }
|
||||
|
||||
- name: Delete storage account
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
state: absent
|
||||
|
||||
- name: Create new storage account
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
account_type: Standard_LRS
|
||||
tags:
|
||||
test: test
|
||||
galaxy: galaxy
|
||||
register: output
|
||||
|
||||
- name: Assert status succeeded and results include an Id value
|
||||
assert:
|
||||
that:
|
||||
- output.changed
|
||||
- output.state.id is defined
|
||||
|
||||
- name: Gather facts by tags
|
||||
azure_rm_storageaccount_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
tags:
|
||||
- test
|
||||
- galaxy
|
||||
|
||||
- assert:
|
||||
that: azure_storageaccounts | length >= 1
|
||||
|
||||
- name: Change account type
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
account_type: Premium_LRS
|
||||
register: change_account
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Assert account type change failed
|
||||
assert: { that: "change_account['failed'] == True" }
|
||||
|
||||
- name: Change account type and add custom domain
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
account_type: Standard_GRS
|
||||
custom_domain: { name: ansible.com, use_sub_domain: no }
|
||||
register: change_account
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Assert CNAME failure
|
||||
assert: { that: "'custom domain name could not be verified' in change_account['msg']" }
|
||||
|
||||
- name: Update account tags
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
tags:
|
||||
testing: testing
|
||||
delete: never
|
||||
galaxy: 'no'
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "output.state.tags | length == 3"
|
||||
- "output.state.tags.galaxy == 'no'"
|
||||
|
||||
- name: Update account tags
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
tags:
|
||||
testing: testing
|
||||
delete: never
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "output.state.tags | length == 2"
|
||||
- "output.state.tags.testing == 'testing'"
|
||||
- "output.state.tags.delete == 'never'"
|
||||
|
||||
- name: Gather facts
|
||||
azure_rm_storageaccount_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "azure_storageaccounts| length == 1"
|
||||
|
||||
- name: Gather facts
|
||||
azure_rm_storageaccount_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "azure_storageaccounts | length > 0"
|
||||
|
||||
- name: Delete acccount
|
||||
azure_rm_storageaccount:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ storage_account }}"
|
||||
state: absent
|
Loading…
Add table
Add a link
Reference in a new issue