Skip to content

Commit

Permalink
fix unsafe asserts (#2013)
Browse files Browse the repository at this point in the history
fix unsafe asserts

SUMMARY
Closes #2012
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
  • Loading branch information
markuman authored Dec 1, 2023
1 parent 42c0475 commit 4bdcecd
Show file tree
Hide file tree
Showing 33 changed files with 156 additions and 156 deletions.
6 changes: 3 additions & 3 deletions tests/integration/targets/api_gateway_domain/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- assert:
that:
- create_result.changed == True
- create_result.response.domain.domain_name == "{{ api_gateway_domain_name }}"
- create_result.response.domain.domain_name == api_gateway_domain_name
- create_result.response.domain.distribution_domain_name is defined
- create_result.response.domain.distribution_hosted_zone_id is defined
- create_result.response.path_mappings is defined
Expand All @@ -59,7 +59,7 @@
that:
- repeat_result.changed == False
- repeat_result.failed == False
- repeat_result.response.domain_name == "{{ api_gateway_domain_name }}"
- repeat_result.response.domain_name == api_gateway_domain_name

- name: Update Test - API gateway custom domain setup, change settings
api_gateway_domain:
Expand All @@ -75,7 +75,7 @@
- assert:
that:
- update_result.changed == True
- update_result.response.domain.domain_name == "{{ api_gateway_domain_name }}"
- update_result.response.domain.domain_name == api_gateway_domain_name
- update_result.response.domain.security_policy == 'TLS_1_2'
- update_result.response.domain.endpoint_configuration.types.0 == 'REGIONAL'
- update_result.response.path_mappings.0.base_path = '/v1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

- assert:
that:
- "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group {{ resource_prefix }}-asg' in result.msg"
- "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group ' ~ resource_prefix ~ '-asg' in result.msg"

- name: test starting a refresh with a valid ASG name - check_mode
autoscaling_instance_refresh:
Expand Down Expand Up @@ -323,7 +323,7 @@

- assert:
that:
- "{{ output.instance_refreshes|length }} == 0"
- output.instance_refreshes | length == 0

- name: test using a real refresh ID
autoscaling_instance_refresh_info:
Expand All @@ -334,7 +334,7 @@

- assert:
that:
- "{{ output.instance_refreshes |length }} == 1"
- output.instance_refreshes | length == 1

- name: test getting info for an ASG name which doesn't exist
autoscaling_instance_refresh_info:
Expand All @@ -354,7 +354,7 @@

- assert:
that:
- "{{ output.instance_refreshes|length }} == 7"
- output.instance_refreshes | length == 7

- name: assert that valid message with fake-token is returned
autoscaling_instance_refresh_info:
Expand All @@ -376,7 +376,7 @@

- assert:
that:
- "{{ output.instance_refreshes|length }} < 2"
- output.instance_refreshes | length < 2

- name: assert that valid message with real-token is returned
autoscaling_instance_refresh_info:
Expand All @@ -387,7 +387,7 @@

- assert:
that:
- "{{ output.instance_refreshes|length }} == 7"
- output.instance_refreshes | length == 7

- name: test using both real nextToken and max_records=1
autoscaling_instance_refresh_info:
Expand All @@ -399,7 +399,7 @@

- assert:
that:
- "{{ output.instance_refreshes|length }} == 1"
- output.instance_refreshes | length == 1

always:

Expand Down
20 changes: 10 additions & 10 deletions tests/integration/targets/autoscaling_policy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_simplescaling_policy"
- result.policy_name == resource_prefix ~ '_simplescaling_policy'
- result.changed

- name: Update Simple Scaling policy using explicit defaults
Expand All @@ -61,7 +61,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_simplescaling_policy"
- result.policy_name == resource_prefix ~ '_simplescaling_policy'
- not result.changed

- name: min_adjustment_step is ignored with ChangeInCapacity
Expand All @@ -77,7 +77,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_simplescaling_policy"
- result.policy_name == resource_prefix ~ '_simplescaling_policy'
- not result.changed
- result.adjustment_type == "ChangeInCapacity"

Expand All @@ -94,7 +94,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_simplescaling_policy"
- result.policy_name == resource_prefix ~ '_simplescaling_policy'
- result.changed
- result.adjustment_type == "PercentChangeInCapacity"

Expand Down Expand Up @@ -126,7 +126,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_stepscaling_policy"
- result.policy_name == resource_prefix ~ '_stepscaling_policy'
- result.changed

- name: Add another step
Expand All @@ -149,7 +149,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_stepscaling_policy"
- result.policy_name == resource_prefix ~ '_stepscaling_policy'
- result.changed
- result.adjustment_type == "PercentChangeInCapacity"

Expand Down Expand Up @@ -189,7 +189,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_targettracking_predefined_policy"
- result.policy_name == resource_prefix ~ '_targettracking_predefined_policy'
- result.changed
- result is successful

Expand All @@ -206,7 +206,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_targettracking_predefined_policy"
- result.policy_name == resource_prefix ~ '_targettracking_predefined_policy'
- result is not changed

# # It would be good to also test this but we would need an Target group and an ALB
Expand Down Expand Up @@ -263,7 +263,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_targettracking_custom_policy"
- result.policy_name == resource_prefix ~ '_targettracking_custom_policy'
- result.changed
- result is successful

Expand All @@ -285,7 +285,7 @@

- assert:
that:
- result.policy_name == "{{ resource_prefix }}_targettracking_custom_policy"
- result.policy_name == resource_prefix ~ '_targettracking_custom_policy'
- result is not changed

always:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
that:
- scheduled_action is successful
- scheduled_action is changed
- scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test"
- scheduled_action.scheduled_action_name == resource_prefix ~ '-test'
- scheduled_action.desired_capacity == 2

- name: Create basic scheduled_action - idempotent
Expand Down Expand Up @@ -155,7 +155,7 @@
that:
- scheduled_action is successful
- scheduled_action is changed
- scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test"
- scheduled_action.scheduled_action_name == resource_prefix ~ '-test'
- scheduled_action.desired_capacity == 3
- scheduled_action.min_size == 3

Expand Down Expand Up @@ -217,7 +217,7 @@
that:
- advanced_scheduled_action is successful
- advanced_scheduled_action is changed
- advanced_scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test1"
- advanced_scheduled_action.scheduled_action_name == resource_prefix ~ '-test1'
- advanced_scheduled_action.desired_capacity == 2
- advanced_scheduled_action.min_size == 2
- advanced_scheduled_action.max_size == 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
that:
- update_origin_origin_shield.changed
- update_origin_origin_shield.origins['items'][0].origin_shield.enabled
- update_origin_origin_shield.origins['items'][0].origin_shield.origin_shield_region == '{{ aws_region }}'
- update_origin_origin_shield.origins['items'][0].origin_shield.origin_shield_region == aws_region

# TODO: fix module idempotency issue
# - name: enable origin Origin Shield again to test idempotency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
that:
- create_result is changed
- create_result is not failed
- create_result.response_headers_policy.response_headers_policy_config.name == "{{ resource_prefix }}-my-header-policy"
- create_result.response_headers_policy.response_headers_policy_config.name == resource_prefix ~ '-my-header-policy'

- name: Rerun same task to ensure idempotence
cloudfront_response_headers_policy:
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/targets/codecommit_repository/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'
- output.repository_metadata.repository_description == 'original comment'

- name: No-op update to repository
Expand All @@ -39,7 +39,7 @@
- assert:
that:
- output is not changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'
- output.repository_metadata.repository_description == 'original comment'

- name: Update repository description (CHECK MODE)
Expand All @@ -52,7 +52,7 @@
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'
- output.repository_metadata.repository_description == 'original comment'

- name: Update repository description
Expand All @@ -64,7 +64,7 @@
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'
- output.repository_metadata.repository_description == 'new comment'

# ============================================================
Expand Down Expand Up @@ -104,7 +104,7 @@
- assert:
that:
- output is changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'

- name: No-op update to repository without description
codecommit_repository:
Expand All @@ -114,7 +114,7 @@
- assert:
that:
- output is not changed
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
- output.repository_metadata.repository_name == resource_prefix ~ '_repo'

- name: Delete a repository without description
codecommit_repository:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/codepipeline/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
- assert:
that:
- output.changed == True
- output.pipeline.name == "{{ codepipeline_name }}"
- output.pipeline.name == codepipeline_name
- output.pipeline.stages|length > 1

- name: idempotence check rerunning same CodePipeline task
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/connection/test_assume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

- assert:
that:
- id_cmd.stdout == '{{ user_name }}'
- id_cmd.stdout == user_name
Loading

0 comments on commit 4bdcecd

Please sign in to comment.