mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add integration tests for sqs_queue module (#40110)
This commit is contained in:
parent
223a4c0685
commit
12055eace6
3 changed files with 118 additions and 0 deletions
2
test/integration/targets/sqs_queue/aliases
Normal file
2
test/integration/targets/sqs_queue/aliases
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
cloud/aws
|
||||||
|
posix/ci/cloud/group4/aws
|
1
test/integration/targets/sqs_queue/defaults/main.yml
Normal file
1
test/integration/targets/sqs_queue/defaults/main.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
---
|
115
test/integration/targets/sqs_queue/tasks/main.yml
Normal file
115
test/integration/targets/sqs_queue/tasks/main.yml
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
---
|
||||||
|
- name: set up aws connection info
|
||||||
|
set_fact:
|
||||||
|
aws_connection_info: &aws_connection_info
|
||||||
|
aws_access_key: "{{ aws_access_key }}"
|
||||||
|
aws_secret_key: "{{ aws_secret_key }}"
|
||||||
|
security_token: "{{ security_token }}"
|
||||||
|
region: "{{ aws_region }}"
|
||||||
|
no_log: yes
|
||||||
|
- block:
|
||||||
|
- name: Test creating SQS queue
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ resource_prefix }}{{ 1000 | random }}"
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: create_result
|
||||||
|
- name: Assert SQS queue created
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- create_result.changed
|
||||||
|
- create_result.region == "{{ aws_region }}"
|
||||||
|
always:
|
||||||
|
- name: Test deleting SQS queue
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ create_result.name }}"
|
||||||
|
state: absent
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: delete_result
|
||||||
|
retries: 3
|
||||||
|
delay: 3
|
||||||
|
until: delete_result.changed
|
||||||
|
- name: Assert SQS queue deleted
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- delete_result.changed
|
||||||
|
- name: Test delete SQS queue that doesn't exist
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ resource_prefix }}{{ 1000 | random }}"
|
||||||
|
state: absent
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: delete_result
|
||||||
|
- name: Assert delete non-existant queue returns cleanly
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- delete_result.changed == False
|
||||||
|
- name: Test queue features
|
||||||
|
block:
|
||||||
|
- name: Test create queue with attributes
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ resource_prefix }}{{ 1000 | random }}"
|
||||||
|
default_visibility_timeout: 900
|
||||||
|
delivery_delay: 900
|
||||||
|
maximum_message_size: 9009
|
||||||
|
message_retention_period: 900
|
||||||
|
receive_message_wait_time: 10
|
||||||
|
policy:
|
||||||
|
Version: "2012-10-17"
|
||||||
|
Statement:
|
||||||
|
Effect: Allow
|
||||||
|
Action: "*"
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: create_result
|
||||||
|
- name: Assert queue created with configuration
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- create_result.changed
|
||||||
|
- create_result.default_visibility_timeout == "900"
|
||||||
|
- create_result.delivery_delay == "900"
|
||||||
|
- create_result.maximum_message_size == "9009"
|
||||||
|
- create_result.message_retention_period == "900"
|
||||||
|
- create_result.receive_message_wait_time == "10"
|
||||||
|
- create_result.policy.Version == "2012-10-17"
|
||||||
|
- create_result.policy.Statement.Effect == "Allow"
|
||||||
|
- create_result.policy.Statement.Action == "*"
|
||||||
|
always:
|
||||||
|
- name: Cleaning up queue
|
||||||
|
echo: "{{ create_result.name }}"
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ create_result.name }}"
|
||||||
|
state: absent
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: delete_result
|
||||||
|
retries: 3
|
||||||
|
delay: 3
|
||||||
|
until: delete_result.changed
|
||||||
|
- name: Test queue with redrive
|
||||||
|
block:
|
||||||
|
- name: Creating dead letter queue
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ resource_prefix }}{{ 1000 | random }}"
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: dead_letter_queue
|
||||||
|
- name: Test create queue with redrive_policy
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ resource_prefix }}{{ 1000 | random }}"
|
||||||
|
redrive_policy:
|
||||||
|
maxReceiveCount: 5
|
||||||
|
deadLetterTargetArn: "{{ dead_letter_queue.queue_arn }}"
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: create_result
|
||||||
|
- name: Assert queue created with configuration
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- create_result.changed
|
||||||
|
always:
|
||||||
|
- name: Cleaning up queue
|
||||||
|
sqs_queue:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
state: absent
|
||||||
|
<<: *aws_connection_info
|
||||||
|
register: delete_result
|
||||||
|
retries: 3
|
||||||
|
delay: 3
|
||||||
|
with_items:
|
||||||
|
- { name: "{{ create_result.name }}" }
|
||||||
|
- { name: "{{ dead_letter_queue.name }}" }
|
Loading…
Reference in a new issue