mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
Elasticbeanstalk app (#31079)
* New AWS elasticbeanstalk app module * Integration tests for elasticbeanstalk_app
This commit is contained in:
parent
5814f9effa
commit
7fa09390b0
5 changed files with 386 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
cloud/aws
|
||||
posix/ci/cloud/group1/aws
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
# defaults file for aws_elasticbeanstalk_app
|
||||
app_name: '{{ resource_prefix }}_eb_ansible_test'
|
||||
description: 'eb_ansible_test app description'
|
||||
alternate_description: 'eb_ansible_test app alternate_description'
|
|
@ -0,0 +1,3 @@
|
|||
dependencies:
|
||||
- prepare_tests
|
||||
- setup_ec2
|
156
test/integration/targets/aws_elasticbeanstalk_app/tasks/main.yml
Normal file
156
test/integration/targets/aws_elasticbeanstalk_app/tasks/main.yml
Normal file
|
@ -0,0 +1,156 @@
|
|||
---
|
||||
# tasks file for aws_elasticbeanstalk_app
|
||||
- block:
|
||||
|
||||
- name: set connection information for all tasks
|
||||
set_fact:
|
||||
aws_connection_info: &aws_connection_info
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
aws_secret_key: "{{ aws_secret_key }}"
|
||||
security_token: "{{ security_token }}"
|
||||
region: "{{ aws_region }}"
|
||||
no_log: yes
|
||||
|
||||
# ============================================================
|
||||
- name: test with no parameters
|
||||
aws_elasticbeanstalk_app:
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- name: assert failure when called with no parameters
|
||||
assert:
|
||||
that:
|
||||
- 'result.failed'
|
||||
|
||||
# ============================================================
|
||||
- name: test create app
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "{{ app_name }}"
|
||||
description: "{{ description }}"
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- name: assert changed is True
|
||||
assert:
|
||||
that:
|
||||
- result.changed == True
|
||||
|
||||
# ============================================================
|
||||
- name: test create when app already exists
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "{{ app_name }}"
|
||||
description: "{{ description }}"
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- name: assert changed is False since the app already exists
|
||||
assert:
|
||||
that:
|
||||
- result.changed == False
|
||||
|
||||
# ============================================================
|
||||
- name: make an update to an existing app
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "{{ app_name }}"
|
||||
description: "{{ alternate_description }}"
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- name: assert changed is True
|
||||
assert:
|
||||
that:
|
||||
- result.changed == True
|
||||
|
||||
# # ============================================================
|
||||
# - name: fail deleting an app that has environments that exist
|
||||
# aws_elasticbeanstalk_app:
|
||||
# app_name: "non_app"
|
||||
# state: absent
|
||||
# <<: *aws_connection_info
|
||||
# register: result
|
||||
# ignore_error: true
|
||||
#
|
||||
# - name: assert deleteing app with running environments fail
|
||||
# assert:
|
||||
# that:
|
||||
# - result.changed == False
|
||||
|
||||
# # ============================================================
|
||||
# - name: deleting an app that has environments that exist with terminate_by_force True
|
||||
# aws_elasticbeanstalk_app:
|
||||
# app_name: "non_app"
|
||||
# state: absent
|
||||
# terminate_by_force: True
|
||||
# <<: *aws_connection_info
|
||||
# register: result
|
||||
#
|
||||
# - name: assert deleteing app with running environments with terminate_by_force True
|
||||
# assert:
|
||||
# that:
|
||||
# - result.changed == True
|
||||
#
|
||||
# ============================================================
|
||||
# - name: retrieve a list of apps
|
||||
# aws_elasticbeanstalk_app_facts:
|
||||
# <<: *aws_connection_info
|
||||
# register: result
|
||||
|
||||
# - name: assert changed is True
|
||||
# assert:
|
||||
# that:
|
||||
# - result is success
|
||||
|
||||
# # ============================================================
|
||||
# - name: deleting an app that has environments that exist with terminate_by_force True
|
||||
# aws_elasticbeanstalk_app:
|
||||
# app_name: "non_app"
|
||||
# state: absent
|
||||
# terminate_by_force: True
|
||||
# <<: *aws_connection_info
|
||||
# register: result
|
||||
#
|
||||
# - name: assert deleteing app with running environments with terminate_by_force True
|
||||
# assert:
|
||||
# that:
|
||||
# - result.changed == True
|
||||
#
|
||||
# ============================================================
|
||||
- name: delete non existent app
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "non_app"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
ignore_error: true
|
||||
|
||||
- name: assert deleteing non existant app fails
|
||||
assert:
|
||||
that:
|
||||
- result.changed == False
|
||||
- 'result.output.startswith("Application not found")'
|
||||
|
||||
# ============================================================
|
||||
- name: delete existing app
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "{{ app_name }}"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- name: assert changed is True
|
||||
assert:
|
||||
that:
|
||||
- result.changed == True
|
||||
|
||||
# ============================================================
|
||||
|
||||
always:
|
||||
|
||||
- name: delete existing app
|
||||
aws_elasticbeanstalk_app:
|
||||
app_name: "{{ app_name }}"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
Loading…
Add table
Add a link
Reference in a new issue