Skip to content

Commit

Permalink
change: Integration Tests now dynamically checks AZs (#989)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
knakad committed Aug 20, 2019
1 parent b9f6cfb commit 3cf4f9b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/integ/vpc_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ def _create_vpc_with_name(ec2_client, region, name):
vpc_id = ec2_client.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"]["VpcId"]
print("created vpc: {}".format(vpc_id))

# sagemaker endpoints require subnets in at least 2 different AZs for vpc mode
availability_zone_name = ec2_client.describe_availability_zones()["AvailabilityZones"][0][
"ZoneName"
]

subnet_id_a = ec2_client.create_subnet(
CidrBlock="10.0.0.0/24", VpcId=vpc_id, AvailabilityZone=(region + "a")
CidrBlock="10.0.0.0/24", VpcId=vpc_id, AvailabilityZone=availability_zone_name
)["Subnet"]["SubnetId"]
print("created subnet: {}".format(subnet_id_a))
subnet_id_b = ec2_client.create_subnet(
CidrBlock="10.0.1.0/24", VpcId=vpc_id, AvailabilityZone=(region + "b")
CidrBlock="10.0.1.0/24", VpcId=vpc_id, AvailabilityZone=availability_zone_name
)["Subnet"]["SubnetId"]
print("created subnet: {}".format(subnet_id_b))

Expand Down

0 comments on commit 3cf4f9b

Please sign in to comment.