| 1 |
--- |
| 2 |
- name: 'aws_elasticbeanstalk_app integration tests' |
| 3 |
collections: |
| 4 |
- amazon.aws |
| 5 |
module_defaults: |
| 6 |
group/aws: |
| 7 |
access_key: '{{ aws_access_key }}' |
| 8 |
secret_key: '{{ aws_secret_key }}' |
| 9 |
session_token: '{{ security_token | default(omit) }}' |
| 10 |
region: '{{ aws_region }}' |
| 11 |
block: |
| 12 |
|
| 13 |
# ============================================================ |
| 14 |
- name: test with no parameters |
| 15 |
elasticbeanstalk_app: |
| 16 |
register: result |
| 17 |
ignore_errors: true |
| 18 |
|
| 19 |
- name: assert failure when called with no parameters |
| 20 |
assert: |
| 21 |
that: |
| 22 |
- 'result.failed' |
| 23 |
|
| 24 |
# ============================================================ |
| 25 |
- name: test create app |
| 26 |
elasticbeanstalk_app: |
| 27 |
app_name: "{{ app_name }}" |
| 28 |
description: "{{ description }}" |
| 29 |
state: present |
| 30 |
register: result |
| 31 |
|
| 32 |
- name: assert changed is True |
| 33 |
assert: |
| 34 |
that: |
| 35 |
- result.changed == True |
| 36 |
|
| 37 |
# ============================================================ |
| 38 |
- name: test create when app already exists |
| 39 |
elasticbeanstalk_app: |
| 40 |
app_name: "{{ app_name }}" |
| 41 |
description: "{{ description }}" |
| 42 |
state: present |
| 43 |
register: result |
| 44 |
|
| 45 |
- name: assert changed is False since the app already exists |
| 46 |
assert: |
| 47 |
that: |
| 48 |
- result.changed == False |
| 49 |
|
| 50 |
# ============================================================ |
| 51 |
- name: make an update to an existing app |
| 52 |
elasticbeanstalk_app: |
| 53 |
app_name: "{{ app_name }}" |
| 54 |
description: "{{ alternate_description }}" |
| 55 |
state: present |
| 56 |
register: result |
| 57 |
|
| 58 |
- name: assert changed is True |
| 59 |
assert: |
| 60 |
that: |
| 61 |
- result.changed == True |
| 62 |
|
| 63 |
# # ============================================================ |
| 64 |
# - name: fail deleting an app that has environments that exist |
| 65 |
# elasticbeanstalk_app: |
| 66 |
# app_name: "non_app" |
| 67 |
# state: absent |
| 68 |
# register: result |
| 69 |
# ignore_errors: true |
| 70 |
# |
| 71 |
# - name: assert deleteing app with running environments fail |
| 72 |
# assert: |
| 73 |
# that: |
| 74 |
# - result.changed == False |
| 75 |
|
| 76 |
# # ============================================================ |
| 77 |
# - name: deleting an app that has environments that exist with terminate_by_force True |
| 78 |
# elasticbeanstalk_app: |
| 79 |
# app_name: "non_app" |
| 80 |
# state: absent |
| 81 |
# terminate_by_force: True |
| 82 |
# register: result |
| 83 |
# |
| 84 |
# - name: assert deleteing app with running environments with terminate_by_force True |
| 85 |
# assert: |
| 86 |
# that: |
| 87 |
# - result.changed == True |
| 88 |
# |
| 89 |
# ============================================================ |
| 90 |
# - name: retrieve a list of apps |
| 91 |
# aws_elasticbeanstalk_app_facts: |
| 92 |
# register: result |
| 93 |
|
| 94 |
# - name: assert changed is True |
| 95 |
# assert: |
| 96 |
# that: |
| 97 |
# - result is success |
| 98 |
|
| 99 |
# # ============================================================ |
| 100 |
# - name: deleting an app that has environments that exist with terminate_by_force True |
| 101 |
# elasticbeanstalk_app: |
| 102 |
# app_name: "non_app" |
| 103 |
# state: absent |
| 104 |
# terminate_by_force: True |
| 105 |
# register: result |
| 106 |
# |
| 107 |
# - name: assert deleteing app with running environments with terminate_by_force True |
| 108 |
# assert: |
| 109 |
# that: |
| 110 |
# - result.changed == True |
| 111 |
# |
| 112 |
# ============================================================ |
| 113 |
- name: delete non existent app |
| 114 |
elasticbeanstalk_app: |
| 115 |
app_name: "non_app" |
| 116 |
state: absent |
| 117 |
register: result |
| 118 |
ignore_errors: true |
| 119 |
|
| 120 |
- name: assert deleteing non existant app fails |
| 121 |
assert: |
| 122 |
that: |
| 123 |
- result.changed == False |
| 124 |
- 'result.output.startswith("Application not found")' |
| 125 |
|
| 126 |
# ============================================================ |
| 127 |
- name: delete existing app |
| 128 |
elasticbeanstalk_app: |
| 129 |
app_name: "{{ app_name }}" |
| 130 |
state: absent |
| 131 |
register: result |
| 132 |
|
| 133 |
- name: assert changed is True |
| 134 |
assert: |
| 135 |
that: |
| 136 |
- result.changed == True |
| 137 |
|
| 138 |
# ============================================================ |
| 139 |
|
| 140 |
always: |
| 141 |
|
| 142 |
- name: delete existing app |
| 143 |
elasticbeanstalk_app: |
| 144 |
app_name: "{{ app_name }}" |
| 145 |
state: absent |