fix rediscache/firewall tests (#54933)

* cleaned up tagging to prevent long-running tasks in CI
This commit is contained in:
Matt Davis 2019-04-05 16:30:57 -07:00 committed by GitHub
parent 1de1d081a5
commit 2b9b5f5bb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,6 @@
- facts.rediscaches[0].sku.name == 'basic' - facts.rediscaches[0].sku.name == 'basic'
- facts.rediscaches[0].sku.size == 'C1' - facts.rediscaches[0].sku.size == 'C1'
- name: Update the redis cache (idempotent) - name: Update the redis cache (idempotent)
azure_rm_rediscache: azure_rm_rediscache:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
@ -67,96 +66,117 @@
that: that:
- not output.changed - not output.changed
# creating redis Cache costs about 20 mins async operation, - name: long-running rediscache tests [run with `--tags long_run,untagged` to enable]
# need to poll status from Creating to Running, then able to perform updating/deleting operation, # creating redis Cache costs about 20 mins async operation,
# otherwise, will met error: # need to poll status from Creating to Running, then able to perform updating/deleting operation,
# "The resource '<resource_id>' is busy processing a previous update request or is undergoing system maintenance. # otherwise, will met error:
# As such, it is currently unable to accept the update request. Please try again later." # "The resource '<resource_id>' is busy processing a previous update request or is undergoing system maintenance.
# comment out updating/deleting tests for test efficiency. # As such, it is currently unable to accept the update request. Please try again later."
# - name: Update redis cache block:
# azure_rm_rediscache: - name: Wait for Redis provisioning to complete
# resource_group: "{{ resource_group }}" azure_rm_rediscache_facts:
# name: "{{ redis_name }}" resource_group: "{{ resource_group }}"
# sku: name: "{{ redis_name }}"
# name: basic register: facts
# size: C1 until: facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
# enable_non_ssl_port: true retries: 30
# tags: delay: 60
# testing: foo
# register: output
# - name: assert output changed - name: (actually) update redis cache
# assert: azure_rm_rediscache:
# that: resource_group: "{{ resource_group }}"
# - output.changed name: "{{ redis_name }}"
sku:
name: basic
size: C1
enable_non_ssl_port: true
tags:
testing: foo
register: output
# - name: Update redis cache configuration - name: assert output changed
# azure_rm_rediscache: assert:
# resource_group: "{{ resource_group }}" that:
# name: "{{ redis_name }}" - output.changed
# sku:
# name: basic
# size: C1
# enable_non_ssl_port: true
# maxmemory_policy: allkeys_lru
# tags:
# testing: foo
# register: output
# - name: assert output changed - name: Update redis cache configuration
# assert: azure_rm_rediscache:
# that: resource_group: "{{ resource_group }}"
# - output.changed name: "{{ redis_name }}"
sku:
name: basic
size: C1
enable_non_ssl_port: true
maxmemory_policy: allkeys_lru
tags:
testing: foo
register: output
# - name: Scale up the redis cache - name: assert output changed
# azure_rm_rediscache: assert:
# resource_group: "{{ resource_group }}" that:
# name: "{{ redis_name }}" - output.changed
# sku:
# name: standard
# size: C1
# tags:
# testing: foo
# register: output
# - assert: - name: Scale up the redis cache
# that: azure_rm_rediscache:
# - output.changed resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
sku:
name: standard
size: C1
tags:
testing: foo
register: output
# - name: Force reboot redis cache - assert:
# azure_rm_rediscache: that:
# resource_group: "{{ resource_group }}" - output.changed
# name: "{{ redis_name }}"
# reboot:
# reboot_type: all
# register: output
# - assert: - name: Wait for Redis provisioning to complete
# that: azure_rm_rediscache_facts:
# - output.changed resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
register: facts
until: facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
retries: 30
delay: 60
# - name: Delete the redis cache (Check Mode) - name: Force reboot redis cache
# azure_rm_rediscache: azure_rm_rediscache:
# resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}" name: "{{ redis_name }}"
# state: absent reboot:
# check_mode: yes reboot_type: all
# register: output register: output
# - name: assert deleting redis cache check mode - assert:
# assert: that:
# that: output.changed - output.changed
# - name: Delete the redis cache - name: Delete the redis cache (Check Mode)
# azure_rm_rediscache: azure_rm_rediscache:
# resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}" name: "{{ redis_name }}"
# state: absent state: absent
# register: output check_mode: yes
register: output
- name: assert deleting redis cache check mode
assert:
that: output.changed
- name: Delete the redis cache
azure_rm_rediscache:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
state: absent
register: output
- assert:
that:
- output.changed
tags: [long_run, never]
# - assert:
# that:
# - output.changed
- name: Create virtual network - name: Create virtual network
azure_rm_virtualnetwork: azure_rm_virtualnetwork:
@ -203,17 +223,6 @@
- facts.rediscaches[0].subnet != None - facts.rediscaches[0].subnet != None
- facts.rediscaches[0].access_keys.primary != None - facts.rediscaches[0].access_keys.primary != None
- name: Wait for Redis provisioning to complete
azure_rm_rediscache_facts:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}2"
register: facts
until: "{{ facts.rediscaches[0]['provisioning_state'] == 'Succeeded' }}"
retries: 30
delay: 60
tags:
- long_run
- name: Create firewall rule (Check mode) - name: Create firewall rule (Check mode)
azure_rm_rediscachefirewallrule: azure_rm_rediscachefirewallrule:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
@ -229,89 +238,83 @@
that: that:
- output.changed - output.changed
- name: long-running rediscachefirewallrule tests [run with `--tags long_run,untagged` to enable]
# Creating firewall rule need Redis status is running, while creating redis Cache costs about 20 mins async operation, # Creating firewall rule need Redis status is running, while creating redis Cache costs about 20 mins async operation,
# need to poll status from Creating to Running, then able to perform firewall rule creating, # need to poll status from Creating to Running, then able to perform firewall rule creating,
# otherwise, will met error: # otherwise, will met error:
# "Error creating/updating Firewall rule of Azure Cache for Redis: Azure Error: Conflict\nMessage: The resource # "Error creating/updating Firewall rule of Azure Cache for Redis: Azure Error: Conflict\nMessage: The resource
# '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Cache/Redis/myRedis' is busy processing # '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Cache/Redis/myRedis' is busy processing
# a previous update request or is undergoing system maintenance. As such, it is currently unable to accept the update request. Please try again later." # a previous update request or is undergoing system maintenance. As such, it is currently unable to accept the update request. Please try again later."
# comment out firewall rule tests for test efficiency. block:
- name: Create firewall rule - name: Wait for Redis provisioning to complete
azure_rm_rediscachefirewallrule: azure_rm_rediscache_facts:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
cache_name: "{{ redis_name }}2" name: "{{ redis_name }}2"
name: "{{ rule_name }}" register: facts
start_ip_address: 192.168.1.1 until: facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
end_ip_address: 192.168.1.4 retries: 30
register: output delay: 60
tags:
- long_run
- name: Assert creation - name: Create firewall rule
assert: azure_rm_rediscachefirewallrule:
that: resource_group: "{{ resource_group }}"
- output.changed cache_name: "{{ redis_name }}2"
- output.id name: "{{ rule_name }}"
tags: start_ip_address: 192.168.1.1
- long_run end_ip_address: 192.168.1.4
register: output
- name: Update firewall rule idempotence - name: Assert creation
azure_rm_rediscachefirewallrule: assert:
resource_group: "{{ resource_group }}" that:
cache_name: "{{ redis_name }}2" - output.changed
name: "{{ rule_name }}" - output.id
start_ip_address: 192.168.1.1
end_ip_address: 192.168.1.4
register: output
tags:
- long_run
- name: Assert idempotence - name: Update firewall rule idempotence
assert: azure_rm_rediscachefirewallrule:
that: resource_group: "{{ resource_group }}"
- output.changed == False cache_name: "{{ redis_name }}2"
tags: name: "{{ rule_name }}"
- long_run start_ip_address: 192.168.1.1
end_ip_address: 192.168.1.4
register: output
- name: Update firewall rule - name: Assert idempotence
azure_rm_rediscachefirewallrule: assert:
resource_group: "{{ resource_group }}" that:
cache_name: "{{ redis_name }}2" - output.changed == False
name: "{{ rule_name }}"
end_ip_address: 192.168.1.5
register: output
tags:
- long_run
- name: Assert updating - name: Update firewall rule
assert: azure_rm_rediscachefirewallrule:
that: resource_group: "{{ resource_group }}"
- output.changed cache_name: "{{ redis_name }}2"
tags: name: "{{ rule_name }}"
- long_run end_ip_address: 192.168.1.5
register: output
- name: Delete firewall rule - name: Assert updating
azure_rm_rediscachefirewallrule: assert:
resource_group: "{{ resource_group }}" that:
cache_name: "{{ redis_name }}2" - output.changed
name: "{{ rule_name }}"
state: absent
register: output
tags:
- long_run
- name: Assert deletion - name: Delete firewall rule
assert: azure_rm_rediscachefirewallrule:
that: resource_group: "{{ resource_group }}"
- output.changed cache_name: "{{ redis_name }}2"
tags: name: "{{ rule_name }}"
- long_run state: absent
register: output
- name: Delete the redis cache - name: Assert deletion
azure_rm_rediscache: assert:
resource_group: "{{ resource_group }}" that:
name: "{{ redis_name }}2" - output.changed
state: absent
register: output - name: Delete the redis cache
tags: azure_rm_rediscache:
- long_run resource_group: "{{ resource_group }}"
name: "{{ redis_name }}2"
state: absent
register: output
tags: [long_run, never]