@ -52,7 +52,6 @@
- facts.rediscaches[0].sku.name == 'basic'
- facts.rediscaches[0].sku.size == 'C1'
- name : Update the redis cache (idempotent)
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
@ -67,96 +66,117 @@
that:
- not output.changed
# creating redis Cache costs about 20 mins async operation,
# need to poll status from Creating to Running, then able to perform updating/deleting operation,
# otherwise, will met error:
# "The resource '<resource_id>' 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."
# comment out updating/deleting tests for test efficiency.
# - name: Update redis cache
# azure_rm_rediscache:
# resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}"
# sku:
# name: basic
# size: C1
# enable_non_ssl_port: true
# tags:
# testing: foo
# register: output
# - name: assert output changed
# assert:
# that:
# - output.changed
# - name: Update redis cache configuration
# azure_rm_rediscache:
# resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}"
# sku:
# name: basic
# size: C1
# enable_non_ssl_port: true
# maxmemory_policy: allkeys_lru
# tags:
# testing: foo
# register: output
# - name: assert output changed
# assert:
# that:
# - output.changed
# - name: Scale up the redis cache
# azure_rm_rediscache:
# resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}"
# sku:
# name: standard
# size: C1
# tags:
# testing: foo
# register: output
# - assert:
# that:
# - output.changed
# - name: Force reboot redis cache
# azure_rm_rediscache:
# resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}"
# reboot:
# reboot_type: all
# register: output
# - assert:
# that:
# - output.changed
# - name: Delete the redis cache (Check Mode)
# azure_rm_rediscache:
# resource_group: "{{ resource_group }}"
# name: "{{ redis_name }}"
# state: absent
# 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
- name : long-running rediscache tests [run with `--tags long_run,untagged` to enable]
# creating redis Cache costs about 20 mins async operation,
# need to poll status from Creating to Running, then able to perform updating/deleting operation,
# otherwise, will met error:
# "The resource '<resource_id>' 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."
block:
- name : Wait for Redis provisioning to complete
azure_rm_rediscache_facts:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
register : facts
until : facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
retries : 30
delay : 60
- name : (actually) update redis cache
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
sku:
name : basic
size : C1
enable_non_ssl_port : true
tags:
testing : foo
register : output
- name : assert output changed
assert:
that:
- output.changed
- name : Update redis cache configuration
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
sku:
name : basic
size : C1
enable_non_ssl_port : true
maxmemory_policy : allkeys_lru
tags:
testing : foo
register : output
- name : assert output changed
assert:
that:
- output.changed
- name : Scale up the redis cache
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
sku:
name : standard
size : C1
tags:
testing : foo
register : output
- assert:
that:
- output.changed
- name : Wait for Redis provisioning to complete
azure_rm_rediscache_facts:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
register : facts
until : facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
retries : 30
delay : 60
- name : Force reboot redis cache
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
reboot:
reboot_type : all
register : output
- assert:
that:
- output.changed
- name : Delete the redis cache (Check Mode)
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}"
state : absent
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]
- name : Create virtual network
azure_rm_virtualnetwork:
@ -203,17 +223,6 @@
- facts.rediscaches[0].subnet != 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)
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
@ -229,89 +238,83 @@
that:
- 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,
# need to poll status from Creating to Running, then able to perform firewall rule creating,
# otherwise, will met error:
# "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
# 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.
- name : Create firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
start_ip_address : 192.168 .1 .1
end_ip_address : 192.168 .1 .4
register : output
tags:
- long_run
- name : Assert creation
assert:
that:
- output.changed
- output.id
tags:
- long_run
- name : Update firewall rule idempotence
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
start_ip_address : 192.168 .1 .1
end_ip_address : 192.168 .1 .4
register : output
tags:
- long_run
- name : Assert idempotence
assert:
that:
- output.changed == False
tags:
- long_run
- name : Update firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
end_ip_address : 192.168 .1 .5
register : output
tags:
- long_run
- name : Assert updating
assert:
that:
- output.changed
tags:
- long_run
- name : Delete firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
state : absent
register : output
tags:
- long_run
- name : Assert deletion
assert:
that:
- output.changed
tags:
- long_run
- name : Delete the redis cache
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}2"
state : absent
register : output
tags:
- long_run
block:
- 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
- name : Create firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
start_ip_address : 192.168 .1 .1
end_ip_address : 192.168 .1 .4
register : output
- name : Assert creation
assert:
that:
- output.changed
- output.id
- name : Update firewall rule idempotence
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
start_ip_address : 192.168 .1 .1
end_ip_address : 192.168 .1 .4
register : output
- name : Assert idempotence
assert:
that:
- output.changed == False
- name : Update firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
end_ip_address : 192.168 .1 .5
register : output
- name : Assert updating
assert:
that:
- output.changed
- name : Delete firewall rule
azure_rm_rediscachefirewallrule:
resource_group : "{{ resource_group }}"
cache_name : "{{ redis_name }}2"
name : "{{ rule_name }}"
state : absent
register : output
- name : Assert deletion
assert:
that:
- output.changed
- name : Delete the redis cache
azure_rm_rediscache:
resource_group : "{{ resource_group }}"
name : "{{ redis_name }}2"
state : absent
register : output
tags : [ long_run, never]