forked from ansible-collections/community.aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid per-test virtual environments where possible (ansible-collectio…
…ns#467) * Move ec2_launch_template to standard role-type test * Run elb_application_lb in our standard environment * Move elb_target_info to the standard role structure * add remote_tmp_dir dependency to ec2_launch_template * move test_multiple_actions_fail.yml inside full_test so we don't need to run the prep work twice * Rename the ALBs: "my-alb" isn't helpful and resource prefix is likely to change on us * Ensure ALBs are deleted if "failed" tests created something
- Loading branch information
1 parent
6e787f7
commit ac391bf
Showing
24 changed files
with
111 additions
and
344 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dependencies: | ||
- prepare_tests | ||
- setup_ec2 | ||
- setup_remote_tmp_dir |
5 changes: 0 additions & 5 deletions
5
tests/integration/targets/ec2_launch_template/playbooks/full_test.yml
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...integration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/meta/main.yml
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
...ntegration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/tasks/main.yml
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
tests/integration/targets/ec2_launch_template/playbooks/version_fail.yml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
tests/integration/targets/ec2_launch_template/tasks/graceful_failure.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- block: | ||
- name: create c4.large template (failure expected) | ||
ec2_launch_template: | ||
state: present | ||
name: "ansible-test-{{ resource_prefix | regex_search('([0-9]+)$') }}-tpl" | ||
instance_type: c4.large | ||
register: ec2_lt | ||
ignore_errors: yes | ||
|
||
- name: check that graceful error message is returned when creation with cpu_options and old botocore | ||
assert: | ||
that: | ||
- ec2_lt is failed | ||
- 'ec2_lt.msg == "ec2_launch_template requires boto3 >= 1.6.0"' | ||
|
||
always: | ||
- name: delete the c4.large template just in case it was created | ||
ec2_launch_template: | ||
state: absent | ||
name: "ansible-test-{{ resource_prefix | regex_search('([0-9]+)$') }}-tpl" | ||
ignore_errors: yes |
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
tests/integration/targets/ec2_launch_template/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
- 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: | ||
|
||
- set_fact: | ||
virtualenv: "{{ remote_tmp_dir }}/virtualenv" | ||
virtualenv_command: "{{ ansible_python_interpreter }} -m virtualenv" | ||
|
||
- set_fact: | ||
virtualenv_interpreter: "{{ virtualenv }}/bin/python" | ||
|
||
- pip: | ||
name: virtualenv | ||
|
||
- pip: | ||
name: | ||
- 'boto3<1.6.0' | ||
- botocore | ||
- boto | ||
- coverage<5 | ||
- cryptography | ||
virtualenv: "{{ virtualenv }}" | ||
virtualenv_command: "{{ virtualenv_command }}" | ||
virtualenv_site_packages: no | ||
|
||
- include_tasks: graceful_failure.yml | ||
vars: | ||
ansible_python_interpreter: "{{ virtualenv_interpreter }}" | ||
|
||
- name: Find AMI to use | ||
ec2_ami_info: | ||
owners: 'amazon' | ||
filters: | ||
name: '{{ ec2_ami_name }}' | ||
register: ec2_amis | ||
- set_fact: | ||
ec2_ami_image: '{{ ec2_amis.images[0].image_id }}' | ||
|
||
- include_tasks: cpu_options.yml | ||
- include_tasks: iam_instance_role.yml | ||
- include_tasks: versions.yml | ||
|
||
always: | ||
|
||
- file: | ||
path: "{{ virtualenv }}" | ||
state: absent |
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions
8
tests/integration/targets/elb_application_lb/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
--- | ||
# load balancer and target group names have to be less than 32 characters | ||
# the 8 digit identifier at the end of resource_prefix helps determine during which test something | ||
# was created and allows tests to be run in parallel | ||
alb_name: "my-alb-{{ resource_prefix | regex_search('([0-9]+)$') }}" | ||
tg_name: "my-tg-{{ resource_prefix | regex_search('([0-9]+)$') }}" | ||
resource_short: "{{ '%0.8x'%((16**8) | random(seed=resource_prefix)) }}" | ||
alb_name: "alb-test-{{ resource_short }}" | ||
tg_name: "alb-test-{{ resource_short }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.