Skip to content

Commit 6a4dc73

Browse files
committed
minor
1 parent e601b59 commit 6a4dc73

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

packages/aws-library/src/aws_library/ec2/_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ async def get_ec2_instance_capabilities(
9696
list_instances: list[EC2InstanceType] = []
9797
for instance in instance_types.get("InstanceTypes", []):
9898
with contextlib.suppress(KeyError):
99+
assert "InstanceType" in instance # nosec
100+
assert "VCpuInfo" in instance # nosec
101+
assert "DefaultVCpus" in instance["VCpuInfo"] # nosec
102+
assert "MemoryInfo" in instance # nosec
103+
assert "SizeInMiB" in instance["MemoryInfo"] # nosec
99104
list_instances.append(
100105
EC2InstanceType(
101106
name=instance["InstanceType"],

packages/aws-library/tests/test_ec2_client.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -625,14 +625,8 @@ async def mock_run_instances(*args, **kwargs) -> Any:
625625
"Code": "InsufficientInstanceCapacity",
626626
"Message": "Insufficient capacity.",
627627
},
628-
"ResponseMetadata": {
629-
"RequestId": "12345678-1234-1234-1234-123456789012",
630-
"HTTPStatusCode": 400,
631-
"HTTPHeaders": {},
632-
"RetryAttempts": 0,
633-
},
634628
}
635-
raise botocore.exceptions.ClientError(error_response, "RunInstances")
629+
raise botocore.exceptions.ClientError(error_response, "RunInstances") # type: ignore
636630
# Second call (second subnet) - succeed normally
637631
assert kwargs["NetworkInterfaces"][0]["SubnetId"] == subnet2_id
638632
return await original_run_instances(*args, **kwargs)
@@ -715,14 +709,8 @@ async def mock_run_instances(*args, **kwargs) -> Any:
715709
"Code": "InsufficientInstanceCapacity",
716710
"Message": "Insufficient capacity.",
717711
},
718-
"ResponseMetadata": {
719-
"RequestId": "12345678-1234-1234-1234-123456789012",
720-
"HTTPStatusCode": 400,
721-
"HTTPHeaders": {},
722-
"RetryAttempts": 0,
723-
},
724712
}
725-
raise botocore.exceptions.ClientError(error_response, "RunInstances")
713+
raise botocore.exceptions.ClientError(error_response, "RunInstances") # type: ignore
726714

727715
# Apply the mock and expect EC2InsufficientCapacityError
728716
mocker.patch.object(
@@ -798,14 +786,8 @@ async def mock_run_instances(*args, **kwargs):
798786
"Code": "InsufficientInstanceCapacity",
799787
"Message": "Insufficient capacity.",
800788
},
801-
"ResponseMetadata": {
802-
"RequestId": "12345678-1234-1234-1234-123456789012",
803-
"HTTPStatusCode": 400,
804-
"HTTPHeaders": {},
805-
"RetryAttempts": 0,
806-
},
807789
}
808-
raise botocore.exceptions.ClientError(error_response, "RunInstances")
790+
raise botocore.exceptions.ClientError(error_response, "RunInstances") # type: ignore
809791

810792
# Apply the mock for the first call
811793
mocker.patch.object(

0 commit comments

Comments
 (0)