Skip to content

Commit 3cf4f9b

Browse files
authored
change: Integration Tests now dynamically checks AZs (#989)
Canaries have failed in Tokyo (ap-northeast-1) since inception because the ap-northeast-1b region doesn't exist. This commit makes the check dynamic instead of blindly assuming that a and b exist, as that isn't the case for 3 regions: ap-northeast-1 ap-northeast-2 sa-east-1
1 parent b9f6cfb commit 3cf4f9b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/integ/vpc_test_utils.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ def _create_vpc_with_name(ec2_client, region, name):
5151
vpc_id = ec2_client.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"]["VpcId"]
5252
print("created vpc: {}".format(vpc_id))
5353

54-
# sagemaker endpoints require subnets in at least 2 different AZs for vpc mode
54+
availability_zone_name = ec2_client.describe_availability_zones()["AvailabilityZones"][0][
55+
"ZoneName"
56+
]
57+
5558
subnet_id_a = ec2_client.create_subnet(
56-
CidrBlock="10.0.0.0/24", VpcId=vpc_id, AvailabilityZone=(region + "a")
59+
CidrBlock="10.0.0.0/24", VpcId=vpc_id, AvailabilityZone=availability_zone_name
5760
)["Subnet"]["SubnetId"]
5861
print("created subnet: {}".format(subnet_id_a))
5962
subnet_id_b = ec2_client.create_subnet(
60-
CidrBlock="10.0.1.0/24", VpcId=vpc_id, AvailabilityZone=(region + "b")
63+
CidrBlock="10.0.1.0/24", VpcId=vpc_id, AvailabilityZone=availability_zone_name
6164
)["Subnet"]["SubnetId"]
6265
print("created subnet: {}".format(subnet_id_b))
6366

0 commit comments

Comments
 (0)