From a145f4a837f688ce58d8c599472aeabfdfeed5fa Mon Sep 17 00:00:00 2001 From: Joseph Torcasso <87090265+jatorcasso@users.noreply.github.com> Date: Mon, 9 May 2022 16:10:04 -0400 Subject: [PATCH] Various integration test fixes (#984) (#1141) Backport stable-2: Various integration test fixes (#984) SUMMARY Backport #984 into stable-2 c5e4640 Reviewed-by: Markus Bergholz --- .../integration/targets/aws_secret/tasks/rotation.yml | 4 ++-- tests/integration/targets/lambda/tasks/main.yml | 8 ++++---- tests/integration/targets/lambda_alias/tasks/main.yml | 6 +++--- tests/integration/targets/lambda_policy/tasks/main.yml | 2 +- .../roles/rds_instance/tasks/test_tagging.yml | 7 +++++++ .../targets/s3_bucket_notification/tasks/main.yml | 4 ++++ tests/integration/targets/wafv2/aliases | 2 ++ tests/integration/targets/wafv2/defaults/main.yml | 10 +++++----- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/integration/targets/aws_secret/tasks/rotation.yml b/tests/integration/targets/aws_secret/tasks/rotation.yml index 823696dbcfc..5a1d146e51a 100644 --- a/tests/integration/targets/aws_secret/tasks/rotation.yml +++ b/tests/integration/targets/aws_secret/tasks/rotation.yml @@ -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 @@ -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 diff --git a/tests/integration/targets/lambda/tasks/main.yml b/tests/integration/targets/lambda/tasks/main.yml index 8846a01cb41..a7a1680d9e6 100644 --- a/tests/integration/targets/lambda/tasks/main.yml +++ b/tests/integration/targets/lambda/tasks/main.yml @@ -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 }}' @@ -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 }}' @@ -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 diff --git a/tests/integration/targets/lambda_alias/tasks/main.yml b/tests/integration/targets/lambda_alias/tasks/main.yml index 6796d14cca6..9b264f50c0a 100644 --- a/tests/integration/targets/lambda_alias/tasks/main.yml +++ b/tests/integration/targets/lambda_alias/tasks/main.yml @@ -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 }}' @@ -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 @@ -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 diff --git a/tests/integration/targets/lambda_policy/tasks/main.yml b/tests/integration/targets/lambda_policy/tasks/main.yml index 2b0e3d38f9f..e0b514bde43 100644 --- a/tests/integration/targets/lambda_policy/tasks/main.yml +++ b/tests/integration/targets/lambda_policy/tasks/main.yml @@ -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}}' diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml b/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml index 0cdd9c1b7a5..954d947d326 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml +++ b/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml @@ -120,6 +120,13 @@ - "result.tags.Name == '{{ instance_id }}-new'" always: + - name: remove final snapshot + rds_instance_snapshot: + db_snapshot_identifier: "{{ instance_id }}" + state: absent + wait: false + ignore_errors: yes + - name: Remove DB instance rds_instance: id: "{{ instance_id }}" diff --git a/tests/integration/targets/s3_bucket_notification/tasks/main.yml b/tests/integration/targets/s3_bucket_notification/tasks/main.yml index fc9b4bb2272..73caae733bc 100644 --- a/tests/integration/targets/s3_bucket_notification/tasks/main.yml +++ b/tests/integration/targets/s3_bucket_notification/tasks/main.yml @@ -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: diff --git a/tests/integration/targets/wafv2/aliases b/tests/integration/targets/wafv2/aliases index 53978c542e1..b473fb47536 100644 --- a/tests/integration/targets/wafv2/aliases +++ b/tests/integration/targets/wafv2/aliases @@ -1,4 +1,6 @@ cloud/aws +# reason: Tests broken - https://github.com/ansible-collections/community.aws/issues/985 +disabled wafv2_resources wafv2_resources_info diff --git a/tests/integration/targets/wafv2/defaults/main.yml b/tests/integration/targets/wafv2/defaults/main.yml index a019a97eaab..ac23638ca83 100644 --- a/tests/integration/targets/wafv2/defaults/main.yml +++ b/tests/integration/targets/wafv2/defaults/main.yml @@ -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 \ No newline at end of file + d: 10.228.231.0/24