Skip to content

Commit

Permalink
amazon.aws 8.0.0 deprecation tests cleanup (#2070)
Browse files Browse the repository at this point in the history
amazon.aws 8.0.0 deprecations - test cleanup

SUMMARY
iam_role moved all of the return values under .iam_role, rather than returning a tangled mess at the top level
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/integration/targets/config/tasks/main.yaml
tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml
tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml
tests/integration/targets/eks_cluster/tasks/full_test.yml
tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml
tests/integration/targets/eks_fargate_profile/tasks/full_test.yml
tests/integration/targets/eks_nodegroup/tasks/dependecies.yml
tests/integration/targets/eks_nodegroup/tasks/full_test.yml
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
  • Loading branch information
tremble authored Apr 8, 2024
1 parent 915cb0d commit 5cb20f7
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 86 deletions.
14 changes: 7 additions & 7 deletions tests/integration/targets/config/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
config_recorder:
name: '{{ resource_prefix }}-recorder'
state: present
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
recording_group:
all_supported: true
include_global_types: true
Expand Down Expand Up @@ -236,7 +236,7 @@
account_sources: []
organization_source:
all_aws_regions: true
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
register: output

- name: assert success
Expand All @@ -251,7 +251,7 @@
account_sources: []
organization_source:
all_aws_regions: true
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
register: output

- name: assert not changed
Expand All @@ -266,7 +266,7 @@
config_recorder:
name: '{{ resource_prefix }}-recorder'
state: present
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
recording_group:
all_supported: false
include_global_types: false
Expand Down Expand Up @@ -348,7 +348,7 @@
all_aws_regions: false
aws_regions:
- '{{ aws_region }}'
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
register: output

- name: assert success
Expand All @@ -365,7 +365,7 @@
all_aws_regions: false
aws_regions:
- '{{ aws_region }}'
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
register: output

- name: assert success
Expand All @@ -380,7 +380,7 @@
config_recorder:
name: '{{ resource_prefix }}-recorder'
state: present
role_arn: "{{ config_iam_role.arn }}"
role_arn: "{{ config_iam_role.iam_role.arn }}"
recording_group:
all_supported: false
include_global_types: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- assert:
that:
- 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")'

- name: Create template again, with no change to instance_role
ec2_launch_template:
Expand All @@ -41,7 +41,7 @@

- assert:
that:
- 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_role is not changed'

- name: Update instance with new instance_role
Expand All @@ -54,8 +54,8 @@

- assert:
that:
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number'
- 'template_with_updated_role is changed'
- 'template_with_updated_role is not failed'
Expand All @@ -71,21 +71,21 @@
- assert:
that:
- 'template_with_updated_role is not changed'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")'

- name: Update instance with original instance_role (pass profile ARN)
ec2_launch_template:
name: "{{ resource_prefix }}-test-instance-role"
image_id: "{{ ec2_ami_id }}"
instance_type: t2.micro
# By default an instance profile will be created with the same name as the role
iam_instance_profile: '{{ iam_role.arn.replace(":role/", ":instance-profile/") }}'
iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}'
register: template_with_updated_role

- assert:
that:
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number'
- 'template_with_updated_role is changed'
- 'template_with_updated_role is not failed'
Expand All @@ -95,13 +95,13 @@
name: "{{ resource_prefix }}-test-instance-role"
image_id: "{{ ec2_ami_id }}"
instance_type: t2.micro
iam_instance_profile: '{{ iam_role.arn.replace(":role/", ":instance-profile/") }}'
iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}'
register: template_with_updated_role

- assert:
that:
- 'template_with_updated_role is not changed'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")'
- 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")'

always:
- name: delete launch template
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,17 @@
>> "rolloutStateReason": "ECS deployment ecs-svc/5156684577543126023 in progress.",
constraints and placement strategies are only changeable if the rollout state is "COMPLETED"
a) ecs_service has currently no waiter function. so this is a DIY waiter
b) the state reached never "COMPLETED" because something if wrong with the ECS EC2 Instances
or the network setup. The EC2 instance never arrived as an active instance in the cluster.
>> no container instance met all of its requirements. Reason: No Container Instances were found in your cluster.
>> For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.
>> ec2_instance networking does not work correctly, no instance available for the cluster
Because all of this, all following tasks, that test the change of a constraint or placement stragegy are
using `force_new_deployment: true`. That ignores a) and b).
using `force_new_deployment: true`. That ignores a) and b).
ignore_errors: true
ecs_service_info:
name: "{{ ecs_service_name }}-constraint"
Expand Down Expand Up @@ -736,7 +736,7 @@
launch_type: FARGATE
cpu: 512
memory: 1024
execution_role_arn: "{{ iam_execution_role.arn }}"
execution_role_arn: "{{ iam_execution_role.iam_role.arn }}"
state: present
vars:
ecs_task_host_port: 8080
Expand All @@ -750,7 +750,7 @@
launch_type: EC2
cpu: 512
memory: 1024
execution_role_arn: "{{ iam_execution_role.arn }}"
execution_role_arn: "{{ iam_execution_role.iam_role.arn }}"
state: present
vars:
ecs_task_host_port: 8080
Expand Down Expand Up @@ -916,7 +916,7 @@
launch_type: FARGATE
cpu: 512
memory: 1024
execution_role_arn: "{{ iam_execution_role.arn }}"
execution_role_arn: "{{ iam_execution_role.iam_role.arn }}"
state: present
runtime_platform:
cpuArchitecture: "ARM64"
Expand All @@ -938,7 +938,7 @@
launch_type: FARGATE
cpu: 512
memory: 1024
execution_role_arn: "{{ iam_execution_role.arn }}"
execution_role_arn: "{{ iam_execution_role.iam_role.arn }}"
state: present
runtime_platform:
cpuArchitecture: "ARM64"
Expand All @@ -960,7 +960,7 @@
launch_type: FARGATE
cpu: 512
memory: 1024
execution_role_arn: "{{ iam_execution_role.arn }}"
execution_role_arn: "{{ iam_execution_role.iam_role.arn }}"
state: present
runtime_platform:
cpuArchitecture: "ARM64"
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/targets/eks_cluster/tasks/full_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
name: "{{ eks_cluster_name }}"
security_groups: "{{ eks_security_groups | map(attribute='name') }}"
subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}"
role_arn: "{{ iam_role.arn }}"
role_arn: "{{ iam_role.iam_role.arn }}"
tags:
Name: "{{ resource_prefix }}"
another: foobar
Expand All @@ -97,7 +97,7 @@
name: "{{ eks_cluster_name }}"
security_groups: "{{ eks_security_groups | map(attribute='name') }}"
subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}"
role_arn: "{{ iam_role.arn }}"
role_arn: "{{ iam_role.iam_role.arn }}"
wait: yes
register: eks_create

Expand All @@ -117,7 +117,7 @@
name: "{{ eks_cluster_name }}"
security_groups: "{{ setup_security_groups.results | map(attribute='group_id') }}"
subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}"
role_arn: "{{ iam_role.arn }}"
role_arn: "{{ iam_role.iam_role.arn }}"
register: eks_create

- name: check that EKS cluster did not change
Expand All @@ -143,7 +143,7 @@
name: "{{ eks_cluster_name }}"
security_groups: "{{ eks_security_groups | map(attribute='name') }}"
subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}"
role_arn: "{{ iam_role.arn }}"
role_arn: "{{ iam_role.iam_role.arn }}"
wait: yes
register: eks_create

Expand All @@ -169,7 +169,7 @@
name: "{{ eks_cluster_short_name }}"
security_groups: "{{ eks_security_groups | map(attribute='name') }}"
subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}"
role_arn: "{{ iam_role.arn }}"
role_arn: "{{ iam_role.iam_role.arn }}"
register: eks_create

- name: check that EKS cluster was created with short name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
name: '{{ eks_cluster_name }}'
security_groups: '{{ eks_security_groups | map(attribute=''name'') }}'
subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}'
role_arn: '{{ iam_role.arn }}'
role_arn: '{{ iam_role.iam_role.arn }}'
wait: true
register: eks_create

Expand Down
Loading

0 comments on commit 5cb20f7

Please sign in to comment.