Fix tests

This commit is contained in:
Andrey Kislyuk 2019-12-13 17:52:37 +00:00 committed by Ubuntu
parent ad234f225f
commit 624dafcb5c
2 changed files with 13 additions and 5 deletions

View File

@ -55,6 +55,10 @@ def _setup(ec2_client, iam_client):
RoleName="TestRole", AssumeRolePolicyDocument="some_policy" RoleName="TestRole", AssumeRolePolicyDocument="some_policy"
) )
iam_arn = resp["Role"]["Arn"] iam_arn = resp["Role"]["Arn"]
iam_client.create_instance_profile(InstanceProfileName="TestRole")
iam_client.add_role_to_instance_profile(
InstanceProfileName="TestRole", RoleName="TestRole"
)
return vpc_id, subnet_id, sg_id, iam_arn return vpc_id, subnet_id, sg_id, iam_arn
@ -83,7 +87,7 @@ def test_create_managed_compute_environment():
"subnets": [subnet_id], "subnets": [subnet_id],
"securityGroupIds": [sg_id], "securityGroupIds": [sg_id],
"ec2KeyPair": "string", "ec2KeyPair": "string",
"instanceRole": iam_arn, "instanceRole": iam_arn.replace("role", "instance-profile"),
"tags": {"string": "string"}, "tags": {"string": "string"},
"bidPercentage": 123, "bidPercentage": 123,
"spotIamFleetRole": "string", "spotIamFleetRole": "string",
@ -209,7 +213,7 @@ def test_delete_managed_compute_environment():
"subnets": [subnet_id], "subnets": [subnet_id],
"securityGroupIds": [sg_id], "securityGroupIds": [sg_id],
"ec2KeyPair": "string", "ec2KeyPair": "string",
"instanceRole": iam_arn, "instanceRole": iam_arn.replace("role", "instance-profile"),
"tags": {"string": "string"}, "tags": {"string": "string"},
"bidPercentage": 123, "bidPercentage": 123,
"spotIamFleetRole": "string", "spotIamFleetRole": "string",

View File

@ -51,6 +51,10 @@ def _setup(ec2_client, iam_client):
RoleName="TestRole", AssumeRolePolicyDocument="some_policy" RoleName="TestRole", AssumeRolePolicyDocument="some_policy"
) )
iam_arn = resp["Role"]["Arn"] iam_arn = resp["Role"]["Arn"]
iam_client.create_instance_profile(InstanceProfileName="TestRole")
iam_client.add_role_to_instance_profile(
InstanceProfileName="TestRole", RoleName="TestRole"
)
return vpc_id, subnet_id, sg_id, iam_arn return vpc_id, subnet_id, sg_id, iam_arn
@ -78,7 +82,7 @@ def test_create_env_cf():
"InstanceTypes": ["optimal"], "InstanceTypes": ["optimal"],
"Subnets": [subnet_id], "Subnets": [subnet_id],
"SecurityGroupIds": [sg_id], "SecurityGroupIds": [sg_id],
"InstanceRole": iam_arn, "InstanceRole": iam_arn.replace("role", "instance-profile"),
}, },
"ServiceRole": iam_arn, "ServiceRole": iam_arn,
}, },
@ -129,7 +133,7 @@ def test_create_job_queue_cf():
"InstanceTypes": ["optimal"], "InstanceTypes": ["optimal"],
"Subnets": [subnet_id], "Subnets": [subnet_id],
"SecurityGroupIds": [sg_id], "SecurityGroupIds": [sg_id],
"InstanceRole": iam_arn, "InstanceRole": iam_arn.replace("role", "instance-profile"),
}, },
"ServiceRole": iam_arn, "ServiceRole": iam_arn,
}, },
@ -195,7 +199,7 @@ def test_create_job_def_cf():
"InstanceTypes": ["optimal"], "InstanceTypes": ["optimal"],
"Subnets": [subnet_id], "Subnets": [subnet_id],
"SecurityGroupIds": [sg_id], "SecurityGroupIds": [sg_id],
"InstanceRole": iam_arn, "InstanceRole": iam_arn.replace("role", "instance-profile"),
}, },
"ServiceRole": iam_arn, "ServiceRole": iam_arn,
}, },