Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boutetnico committed Oct 27, 2022
1 parent b70f4ff commit 4e7bdb6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/integration/targets/cloudfront_distribution/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,44 @@
- update_origin_origin_shield.origins.items[0].origin_shield.enabled
- update_origin_origin_shield.origins.items[0].origin_shield.origin_shield_region == '{{ aws_region }}'

- name: enable origin Origin Shield again to test idempotency
cloudfront_distribution:
distribution_id: "{{ distribution_id }}"
origins:
- domain_name: "{{ cloudfront_hostname }}-origin.example.com"
custom_origin_config:
http_port: 8080
origin_shield:
enabled: true
origin_shield_region: '{{ aws_region }}'
state: present
register: update_origin_origin_shield_idempotency

- name: test idempotency for Origin Shield
assert:
that:
- not update_origin_origin_shield_idempotency.changed
- update_origin_origin_shield_idempotency.origins.items[0].origin_shield.enabled
- update_origin_origin_shield_idempotency.origins.items[0].origin_shield.origin_shield_region == '{{ aws_region }}'

- name: disable origin Origin Shield
cloudfront_distribution:
distribution_id: "{{ distribution_id }}"
origins:
- domain_name: "{{ cloudfront_hostname }}-origin.example.com"
custom_origin_config:
http_port: 8080
origin_shield:
enabled: false
state: present
register: update_origin_origin_shield_disable

- name: ensure origin Origin Shield was disabled
assert:
that:
- update_origin_origin_shield_disable.changed
- not update_origin_origin_shield_disable.origins.items[0].origin_shield.enabled

- name: update restrictions
cloudfront_distribution:
distribution_id: "{{ distribution_id }}"
Expand Down

0 comments on commit 4e7bdb6

Please sign in to comment.