-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws_s3_bucket_info - Add a check for botocore>='1.18.11' when pulling…
… bucket_ownership_controls
- Loading branch information
Showing
6 changed files
with
192 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- aws_s3_bucket_info - added test for botocore>=1.18.11 when attempting to fetch bucket ownership controls (https://github.com/ansible-collections/community.aws/pull/682) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dependencies: | ||
- prepare_tests | ||
- setup_remote_tmp_dir | ||
- setup_ec2 |
72 changes: 72 additions & 0 deletions
72
tests/integration/targets/aws_s3_bucket_info/tasks/basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
- name: Get simple S3 bucket list | ||
aws_s3_bucket_info: | ||
register: bucket_list | ||
|
||
- name: Assert result.changed == False and bucket list was retrieved | ||
assert: | ||
that: | ||
- bucket_list.changed == False | ||
- bucket_list.buckets | ||
|
||
- name: Get complex S3 bucket list | ||
aws_s3_bucket_info: | ||
name_filter: "{{ name_pattern }}" | ||
bucket_facts: | ||
bucket_accelerate_configuration: true | ||
bucket_acl: true | ||
bucket_cors: true | ||
bucket_encryption: true | ||
bucket_lifecycle_configuration: true | ||
bucket_location: true | ||
bucket_logging: true | ||
bucket_notification_configuration: true | ||
bucket_policy: true | ||
bucket_policy_status: true | ||
bucket_replication: true | ||
bucket_request_payment: true | ||
bucket_tagging: true | ||
bucket_website: true | ||
public_access_block: true | ||
transform_location: true | ||
register: bucket_list | ||
|
||
- name: Assert that buckets list contains requested bucket facts | ||
assert: | ||
that: | ||
- item.name is search(name_pattern) | ||
- item.bucket_accelerate_configuration is defined | ||
- item.bucket_acl is defined | ||
- item.bucket_cors is defined | ||
- item.bucket_encryption is defined | ||
- item.bucket_lifecycle_configuration is defined | ||
- item.bucket_location is defined | ||
- item.bucket_logging is defined | ||
- item.bucket_notification_configuration is defined | ||
- item.bucket_policy is defined | ||
- item.bucket_policy_status is defined | ||
- item.bucket_replication is defined | ||
- item.bucket_request_payment is defined | ||
- item.bucket_tagging is defined | ||
- item.bucket_website is defined | ||
- item.public_access_block is defined | ||
loop: "{{ bucket_list.buckets }}" | ||
loop_control: | ||
label: "{{ item.name }}" | ||
|
||
- name: Assert that retrieved bucket facts contains valid data | ||
assert: | ||
that: | ||
- item.bucket_acl.Owner is defined | ||
- item.bucket_tagging.snake_case is defined | ||
- item.bucket_tagging.CamelCase is defined | ||
- item.bucket_tagging["lowercase spaced"] is defined | ||
- item.bucket_tagging["Title Case"] is defined | ||
- item.bucket_tagging.snake_case == 'simple_snake_case' | ||
- item.bucket_tagging.CamelCase == 'SimpleCamelCase' | ||
- item.bucket_tagging["lowercase spaced"] == 'hello cruel world' | ||
- item.bucket_tagging["Title Case"] == 'Hello Cruel World' | ||
- item.bucket_location.LocationConstraint == aws_region | ||
loop: "{{ bucket_list.buckets }}" | ||
loop_control: | ||
label: "{{ item.name }}" |
108 changes: 108 additions & 0 deletions
108
tests/integration/targets/aws_s3_bucket_info/tasks/bucket_ownership_controls.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
- name: Test community.aws.aws_s3_bucket_info | ||
block: | ||
- pip: | ||
name: virtualenv | ||
- set_fact: | ||
virtualenv: "{{ remote_tmp_dir }}/virtualenv" | ||
virtualenv_command: "{{ ansible_python_interpreter }} -m virtualenv" | ||
- set_fact: | ||
virtualenv_interpreter: "{{ virtualenv }}/bin/python" | ||
- pip: | ||
name: | ||
- 'boto3>=1.13.0' | ||
- 'botocore==1.18.11' | ||
- 'coverage<5' | ||
virtualenv: '{{ virtualenv }}' | ||
virtualenv_command: '{{ virtualenv_command }}' | ||
virtualenv_site_packages: no | ||
- name: Wrap test in virtualenv | ||
vars: | ||
ansible_python_interpreter: "{{ virtualenv }}/bin/python" | ||
block: | ||
|
||
- name: Get S3 bucket ownership controls | ||
aws_s3_bucket_info: | ||
name_filter: "{{ name_pattern }}" | ||
bucket_facts: | ||
bucket_ownership_controls: true | ||
transform_location: true | ||
register: bucket_list | ||
|
||
- name: Assert that buckets list contains requested bucket facts | ||
assert: | ||
that: | ||
- item.name is search(name_pattern) | ||
- item.bucket_ownership_controls is defined | ||
loop: "{{ bucket_list.buckets }}" | ||
loop_control: | ||
label: "{{ item.name }}" | ||
|
||
- name: Get complex S3 bucket list (including ownership controls) | ||
aws_s3_bucket_info: | ||
name_filter: "{{ name_pattern }}" | ||
bucket_facts: | ||
bucket_accelerate_configuration: true | ||
bucket_acl: true | ||
bucket_cors: true | ||
bucket_encryption: true | ||
bucket_lifecycle_configuration: true | ||
bucket_location: true | ||
bucket_logging: true | ||
bucket_notification_configuration: true | ||
bucket_ownership_controls: true | ||
bucket_policy: true | ||
bucket_policy_status: true | ||
bucket_replication: true | ||
bucket_request_payment: true | ||
bucket_tagging: true | ||
bucket_website: true | ||
public_access_block: true | ||
transform_location: true | ||
register: bucket_list | ||
|
||
- name: Assert that buckets list contains requested bucket facts | ||
assert: | ||
that: | ||
- item.name is search(name_pattern) | ||
- item.bucket_accelerate_configuration is defined | ||
- item.bucket_acl is defined | ||
- item.bucket_cors is defined | ||
- item.bucket_encryption is defined | ||
- item.bucket_lifecycle_configuration is defined | ||
- item.bucket_location is defined | ||
- item.bucket_logging is defined | ||
- item.bucket_notification_configuration is defined | ||
- item.bucket_ownership_controls is defined | ||
- item.bucket_policy is defined | ||
- item.bucket_policy_status is defined | ||
- item.bucket_replication is defined | ||
- item.bucket_request_payment is defined | ||
- item.bucket_tagging is defined | ||
- item.bucket_website is defined | ||
- item.public_access_block is defined | ||
loop: "{{ bucket_list.buckets }}" | ||
loop_control: | ||
label: "{{ item.name }}" | ||
|
||
- name: Assert that retrieved bucket facts contains valid data | ||
assert: | ||
that: | ||
- item.bucket_acl.Owner is defined | ||
- item.bucket_tagging.snake_case is defined | ||
- item.bucket_tagging.CamelCase is defined | ||
- item.bucket_tagging["lowercase spaced"] is defined | ||
- item.bucket_tagging["Title Case"] is defined | ||
- item.bucket_tagging.snake_case == 'simple_snake_case' | ||
- item.bucket_tagging.CamelCase == 'SimpleCamelCase' | ||
- item.bucket_tagging["lowercase spaced"] == 'hello cruel world' | ||
- item.bucket_tagging["Title Case"] == 'Hello Cruel World' | ||
- item.bucket_location.LocationConstraint == aws_region | ||
loop: "{{ bucket_list.buckets }}" | ||
loop_control: | ||
label: "{{ item.name }}" | ||
|
||
always: | ||
- file: | ||
path: "{{ virtualenv }}" | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters