Skip to content

Commit

Permalink
tests: add tests for bucket owner enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Schwend committed Mar 2, 2022
1 parent 063dc7b commit 8c3604a
Showing 1 changed file with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
- output.object_ownership
- output.object_ownership == 'ObjectWriter'

- name: 'update s3 bucket ownership controls'
- name: 'update s3 bucket ownership preferred controls'
s3_bucket:
name: '{{ local_bucket_name }}'
state: present
Expand All @@ -64,7 +64,7 @@
- output.object_ownership
- output.object_ownership == 'BucketOwnerPreferred'

- name: 'test idempotency update s3 bucket ownership controls'
- name: 'test idempotency update s3 bucket ownership preferred controls'
s3_bucket:
name: '{{ local_bucket_name }}'
state: present
Expand All @@ -77,6 +77,32 @@
- output.object_ownership
- output.object_ownership == 'BucketOwnerPreferred'

- name: 'update s3 bucket ownership enforced controls'
s3_bucket:
name: '{{ local_bucket_name }}'
state: present
object_ownership: BucketOwnerEnforced
register: output

- assert:
that:
- output.changed
- output.object_ownership
- output.object_ownership == 'BucketOwnerEnforced'

- name: 'test idempotency update s3 bucket ownership preferred controls'
s3_bucket:
name: '{{ local_bucket_name }}'
state: present
object_ownership: BucketOwnerEnforced
register: output

- assert:
that:
- output.changed is false
- output.object_ownership
- output.object_ownership == 'BucketOwnerEnforced'

- name: 'delete s3 bucket ownership controls'
s3_bucket:
name: '{{ local_bucket_name }}'
Expand Down

0 comments on commit 8c3604a

Please sign in to comment.