ansible/test/integration/targets/aws_codecommit/tasks/main.yml
Mark Chappell 35359959de aws_codecommit: Fix integration tests and Add support for updating the description (#61263)
* Update DevOps AWS policy
- Fix typos in permission names
- While AWS claims you can use 'arn:aws:codecommit:*' it errors unless you use '*'

* aws_codecommit: (integration tests) Migrate to module_defaults

* aws_codecommit: (integration tests) Fix integration tests

* aws_codecommit: (integration tests) Add tests for updating the description

* aws_codecommit: Add support for updating the description and rename "comment" option to "description"
2019-08-30 11:25:37 -07:00

105 lines
3 KiB
YAML

---
- module_defaults:
group/aws:
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
security_token: "{{ security_token | default(omit) }}"
region: "{{ aws_region }}"
block:
# ============================================================
- name: Create a repository (CHECK MODE)
aws_codecommit:
name: "{{ resource_prefix }}_repo"
description: original comment
state: present
register: output
check_mode: yes
- assert:
that:
- output is changed
- name: Create a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
description: original comment
state: present
register: output
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_description == 'original comment'
- name: No-op update to repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
description: original comment
state: present
register: output
- assert:
that:
- output is not changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_description == 'original comment'
- name: Update repository description (CHECK MODE)
aws_codecommit:
name: "{{ resource_prefix }}_repo"
description: new comment
state: present
register: output
check_mode: yes
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_description == 'original comment'
- name: Update repository description
aws_codecommit:
name: "{{ resource_prefix }}_repo"
description: new comment
state: present
register: output
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_description == 'new comment'
# ============================================================
- name: Delete a repository (CHECK MODE)
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
register: output
check_mode: yes
- assert:
that:
- output is changed
- name: Delete a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
register: output
- assert:
that:
- output is changed
- name: Delete a non-existent repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
register: output
- assert:
that:
- output is not changed
always:
###### TEARDOWN STARTS HERE ######
- name: Delete a repository
aws_codecommit:
name: "{{ resource_prefix }}_repo"
state: absent
ignore_errors: yes