Light, fluffy, and always free - The AWS Local Emulator alternative
fix(ec2): expose m6g.large through the shared instance catalog (#5583)
Andre Kuraitf4c8237229ad
diff --git a/compatibility-tests/sdk-test-python/tests/test_ec2_m6g_catalog.py b/compatibility-tests/sdk-test-python/tests/test_ec2_m6g_catalog.pynew file mode 100644index 0000000000..65764a89b4--- /dev/null+++ b/compatibility-tests/sdk-test-python/tests/test_ec2_m6g_catalog.py@@ -0,0 +1,59 @@+"""M6g discovery verified against live EC2 in us-east-1 and eu-west-1."""++import boto3+import pytest++[email protected](params=["us-east-1", "eu-west-1"])+def catalog_client(request, aws_config, client_config):+ return boto3.client(+ "ec2", config=client_config, **{**aws_config, "region_name": request.param})+++def test_m6g_descriptor(catalog_client):+ types = catalog_client.describe_instance_types(InstanceTypes=["m6g.large"])["InstanceTypes"]+ assert len(types) == 1+ instance_type = types[0]+ assert instance_type["InstanceType"] == "m6g.large"+ assert instance_type["VCpuInfo"]["DefaultVCpus"] == 2+ assert instance_type["MemoryInfo"]["SizeInMiB"] == 8192+ assert instance_type["ProcessorInfo"]["SupportedArchitectures"] == ["arm64"]+ assert instance_type["InstanceStorageSupported"] is False+ assert instance_type["CurrentGeneration"] is True+ assert set(instance_type["SupportedUsageClasses"]) == {"on-demand", "spot"}+ network = instance_type["NetworkInfo"]+ assert network["DefaultNetworkCardIndex"] == 0+ assert network["Ipv4AddressesPerInterface"] == 10+ assert network["EncryptionInTransitSupported"] is False+ assert len(network["NetworkCards"]) == 1+ assert network["NetworkCards"][0]["NetworkCardIndex"] == 0+ assert network["NetworkCards"][0]["MaximumNetworkInterfaces"] == 3+++def test_m6g_offerings(catalog_client):+ region = catalog_client.meta.region_name+ for suffix in ["a", "b", "c"]:+ zone = region + suffix+ offerings = catalog_client.describe_instance_type_offerings(+ LocationType="availability-zone",+ Filters=[{"Name": "location", "Values": [zone]}],+ MaxResults=1000)["InstanceTypeOfferings"]+ assert {"InstanceType": "m6g.large", "LocationType": "availability-zone",+ "Location": zone} in offerings+ assert all(offering["Location"] == zone for offering in offerings)++ offerings = catalog_client.describe_instance_type_offerings(+ LocationType="region",+ Filters=[{"Name": "instance-type", "Values": ["m6g.large"]},+ {"Name": "location", "Values": [region]}])["InstanceTypeOfferings"]+ assert offerings == [+ {"InstanceType": "m6g.large", "LocationType": "region", "Location": region}]+ for location_type, location, instance_type in [+ ("availability-zone", "other-zone", "m6g.large"),+ ("region", "us-west-2", "m6g.large"),+ ("region", region, "not-a-real-instance-type"),+ ]:+ assert catalog_client.describe_instance_type_offerings(+ LocationType=location_type,+ Filters=[{"Name": "instance-type", "Values": [instance_type]},+ {"Name": "location", "Values": [location]}])["InstanceTypeOfferings"] == []diff --git a/src/main/resources/ec2/instance-type-catalog.yaml b/src/main/resources/ec2/instance-type-catalog.yamlindex bab17aa7e7..20ea294dcd 100644--- a/src/main/resources/ec2/instance-type-catalog.yaml+++ b/src/main/resources/ec2/instance-type-catalog.yaml@@ -207,6 +207,19 @@ instanceTypes:- networkCardIndex: 0maximumNetworkInterfaces: 3+ - instanceType: m6g.large+ vcpu: 2+ memoryMib: 8192+ supportedArchitectures:+ - arm64+ currentGeneration: true+ encryptionInTransitSupported: false+ defaultNetworkCardIndex: 0+ ipv4AddressesPerInterface: 10+ networkCards:+ - networkCardIndex: 0+ maximumNetworkInterfaces: 3+- instanceType: m6gd.largevcpu: 2memoryMib: 8192diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2InstanceTypeCatalogTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2InstanceTypeCatalogTest.javaindex da02b130c8..6595c134f4 100644--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2InstanceTypeCatalogTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2InstanceTypeCatalogTest.java@@ -44,6 +44,7 @@ class Ec2InstanceTypeCatalogTest {"t4g.micro","t4g.small","t4g.medium",+ "m6g.large","m6gd.large","m6gd.2xlarge","m7gd.large",diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2IntegrationTest.javaindex de30e52879..c64135528a 100644--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2IntegrationTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2IntegrationTest.java@@ -1157,6 +1157,72 @@ class Ec2IntegrationTest {everyItem(equalTo("arm64")));}+ @Test+ void describeEbsOnlyGravitonInstanceType() {+ given()+ .formParam("Action", "DescribeInstanceTypes")+ .formParam("InstanceType.1", "m6g.large")+ .header("Authorization", AUTH_HEADER)+ .when()+ .post("/")+ .then()+ .statusCode(200)+ .body("DescribeInstanceTypesResponse.instanceTypeSet.item.size()", equalTo(1))+ .body("DescribeInstanceTypesResponse.instanceTypeSet.item.vCpuInfo.defaultVCpus", equalTo("2"))+ .body("DescribeInstanceTypesResponse.instanceTypeSet.item.memoryInfo.sizeInMiB", equalTo("8192"))+ .body("DescribeInstanceTypesResponse.instanceTypeSet.item.processorInfo.supportedArchitectures.item",+ equalTo("arm64"))+ .body("DescribeInstanceTypesResponse.instanceTypeSet.item.instanceStorageSupported", equalTo("false"));+ }++ @Test+ void describeEbsOnlyGravitonOfferingsWithLocationFilters() {+ for (String zone : List.of("us-east-1a", "us-east-1b", "us-east-1c")) {+ given()+ .formParam("Action", "DescribeInstanceTypeOfferings")+ .formParam("LocationType", "availability-zone")+ .formParam("Filter.1.Name", "location")+ .formParam("Filter.1.Value.1", zone)+ .formParam("MaxResults", "1000")+ .header("Authorization", AUTH_HEADER)+ .when()+ .post("/")+ .then()+ .statusCode(200)+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.instanceType",+ hasItems("m6g.large", "m5.large"))+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.location", everyItem(equalTo(zone)));+ }+ given()+ .formParam("Action", "DescribeInstanceTypeOfferings")+ .formParam("LocationType", "region")+ .formParam("Filter.1.Name", "instance-type")+ .formParam("Filter.1.Value.1", "m6g.large")+ .formParam("Filter.2.Name", "location")+ .formParam("Filter.2.Value.1", "us-east-1")+ .header("Authorization", AUTH_HEADER)+ .when()+ .post("/")+ .then()+ .statusCode(200)+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.size()", equalTo(1))+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.instanceType", equalTo("m6g.large"))+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.location", equalTo("us-east-1"));+ given()+ .formParam("Action", "DescribeInstanceTypeOfferings")+ .formParam("LocationType", "availability-zone")+ .formParam("Filter.1.Name", "instance-type")+ .formParam("Filter.1.Value.1", "m6g.large")+ .formParam("Filter.2.Name", "location")+ .formParam("Filter.2.Value.1", "other-zone")+ .header("Authorization", AUTH_HEADER)+ .when()+ .post("/")+ .then()+ .statusCode(200)+ .body("DescribeInstanceTypeOfferingsResponse.instanceTypeOfferingSet.item.size()", equalTo(0));+ }+@Test@Order(19)void describeInstanceTypeOfferings() {