Skip to content

Commit

Permalink
Added idempotent tests to cloudfront_cache_policy and cloudfront_orig…
Browse files Browse the repository at this point in the history
…in_request_policy tests
  • Loading branch information
Zozman committed Oct 22, 2024
1 parent 9d49a0d commit c27c8e3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/targets/cloudfront_cache_policy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@
- create_result is not failed
- create_result.cache_policy.cache_policy_config.name == "{{ resource_prefix }}-my-cache-policy"

- name: Make sure cache policy creation is idempotent
cloudfront_cache_policy:
name: "{{ resource_prefix }}-my-cache-policy"
comment: Created by Ansible test
default_ttl: 86400
min_ttl: 1
max_ttl: 31536000
parameters_in_cache_key_and_forwarded_to_origin:
enable_accept_encoding_gzip: false
enable_accept_encoding_brotli: false
headers_config:
header_behavior: none
cookies_config:
cookie_behavior: none
query_strings_config:
query_string_behavior: none
state: present
register: idempotent_test_result

- name: Assert cache policy creation is idempotent
assert:
that:
- idempotent_test_result.changed == False

- name: Update existing policy with more complicated configuration
cloudfront_cache_policy:
name: "{{ resource_prefix }}-my-cache-policy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@
- create_result is not failed
- create_result.origin_request_policy.origin_request_policy_config.name == "{{ resource_prefix }}-my-origin-request-policy"

- name: Make sure origin request policy creation is idempotent
cloudfront_origin_request_policy:
name: "{{ resource_prefix }}-my-origin-request-policy"
comment: Created by Ansible test
headers_config:
header_behavior: none
cookies_config:
cookie_behavior: none
query_strings_config:
query_string_behavior: none
state: present
register: idempotent_test_result

- name: Assert origin request policy creation is idempotent
assert:
that:
- idempotent_test_result.changed == False

- name: Update existing policy with more complicated configuration
cloudfront_origin_request_policy:
name: "{{ resource_prefix }}-my-origin-request-policy"
Expand Down

0 comments on commit c27c8e3

Please sign in to comment.