Skip to content

Commit

Permalink
Various integration test fixes (#984)
Browse files Browse the repository at this point in the history
Various integration test fixes

SUMMARY

Updates the version of Python used by lambda in the lambda_alias, lambda_policy and aws_secret integration tests
Updates the version of NodeJS used by the lambda in the lamba integration tests
Adds a retry to the s3_bucket_notification tests, permissions are sometimes a little slow to update
Cleans up Snapshots from rds_instance integration tests
Disables broken WAFv2 integration test (#985)

Fixes: #976
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
aws_secret
lambda
lambda_alias
lambda_policy
rds_policy
s3_bucket_notification
wafv2
ADDITIONAL INFORMATION
Amazon appear to have dropped support for creating Python2.7 lambdas:
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The runtime parameter of python2.7 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions.

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored Mar 14, 2022
1 parent 962827d commit c5e4640
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions tests/integration/targets/aws_secret/tasks/rotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
name: "{{ lambda_name }}"
state: present
zip_file: "{{ tmp.path }}/hello_world.zip"
runtime: 'python2.7'
runtime: 'python3.9'
role: "{{ iam_role_output.arn }}"
handler: 'hello_world.lambda_handler'
register: lambda_output
Expand Down Expand Up @@ -169,7 +169,7 @@
name: "{{ lambda_name }}"
state: absent
zip_file: "{{ tmp.path }}/hello_world.zip"
runtime: 'python2.7'
runtime: 'python3.9'
role: "{{ secret_manager_role }}"
handler: 'hello_world.lambda_handler'
ignore_errors: yes
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/lambda/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
- name: test lambda config updates
lambda:
name: '{{lambda_function_name}}'
runtime: nodejs10.x
runtime: nodejs14.x
tracing_mode: Active
handler: mini_lambda.handler
role: '{{ lambda_role_name }}'
Expand All @@ -139,13 +139,13 @@
that:
- update_result is not failed
- update_result.changed == True
- update_result.configuration.runtime == 'nodejs10.x'
- update_result.configuration.runtime == 'nodejs14.x'
- update_result.configuration.tracing_config.mode == 'Active'

- name: test no changes are made with the same parameters repeated
lambda:
name: '{{lambda_function_name}}'
runtime: nodejs10.x
runtime: nodejs14.x
tracing_mode: Active
handler: mini_lambda.handler
role: '{{ lambda_role_name }}'
Expand All @@ -159,7 +159,7 @@
that:
- update_result is not failed
- update_result.changed == False
- update_result.configuration.runtime == 'nodejs10.x'
- update_result.configuration.runtime == 'nodejs14.x'
- update_result.configuration.tracing_config.mode == 'Active'

- name: reset config updates for the following tests
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/lambda_alias/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: Upload test lambda (version 1)
lambda:
name: '{{ lambda_function_name }}'
runtime: 'python2.7'
runtime: 'python3.7'
handler: 'mini_lambda.handler'
role: '{{ lambda_role_name }}'
zip_file: '{{ zip_res.dest }}'
Expand All @@ -50,7 +50,7 @@
- name: Update lambda (version 2)
lambda:
name: '{{ lambda_function_name }}'
runtime: 'python3.6'
runtime: 'python3.8'
handler: 'mini_lambda.handler'
role: '{{ lambda_role_name }}'
register: lambda_b
Expand All @@ -62,7 +62,7 @@
- name: Update lambda (version 3 / LATEST)
lambda:
name: '{{ lambda_function_name }}'
runtime: 'python3.7'
runtime: 'python3.9'
handler: 'mini_lambda.handler'
role: '{{ lambda_role_name }}'
register: lambda_c
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/lambda_policy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
- name: test state=present - upload the lambda
lambda:
name: '{{lambda_function_name}}'
runtime: python2.7
runtime: python3.9
handler: mini_http_lambda.handler
role: '{{ lambda_role_name }}'
zip_file: '{{zip_res.dest}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@
- "result.snapshots.0.engine == 'mariadb'"

always:
- name: remove snapshot
- name: remove final snapshot
rds_instance_snapshot:
db_snapshot_identifier: "{{ tiny_prefix }}-test-snapshot"
db_snapshot_identifier: "{{ instance_id }}"
state: absent
wait: false
ignore_errors: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
prefix: images/
suffix: .jpg
register: result
retries: 3
delay: 3
until:
- result is successful
- name: assert result.changed == True
assert:
that:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/targets/wafv2/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cloud/aws
# reason: Tests broken - https://github.com/ansible-collections/community.aws/issues/985
disabled

wafv2_resources
wafv2_resources_info
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/targets/wafv2/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
web_acl_name: '{{ resource_prefix }}-web-acl'
rule_group_name: '{{ resource_prefix }}-rule-group'
alb_name: "my-alb-{{ resource_prefix | regex_search('([0-9]+)$') }}"
tg_name: "my-tg-{{ resource_prefix | regex_search('([0-9]+)$') }}"
web_acl_name: '{{ tiny_prefix }}-web-acl'
rule_group_name: '{{ tiny_prefix }}-rule-group'
alb_name: "my-alb-{{ tiny_prefix }}"
tg_name: "my-tg-{{ tiny_prefix }}"
cidr:
main: 10.228.228.0/22
a: 10.228.228.0/24
b: 10.228.229.0/24
c: 10.228.230.0/24
d: 10.228.231.0/24
d: 10.228.231.0/24

0 comments on commit c5e4640

Please sign in to comment.