fix(ec2): include supported usage classes in DescribeInstanceTypes (#3347)

* fix(ec2): include supported usage classes in DescribeInstanceTypes

* test(stepfunctions): document executor fixture dependencies

* test(ec2): document usage class regression coverage
This commit is contained in:
luiseterc authored and GitHub committed 2026-09-10 16:50:41 -04:00
1 parent 084ac87fc4
commit 19f410d6b0
4 files changed
+30 -1

No files matched your search

@@ -278,6 +278,22 @@ class Ec2Tests {
.containsExactly("arm64");
}
/** Regression coverage for the Karpenter instance-type compatibility contract. */
@Test
@Order(7)
@DisplayName("DescribeInstanceTypes - supported usage classes")
void describeInstanceTypeSupportedUsageClasses() {
DescribeInstanceTypesResponse resp = ec2.describeInstanceTypes(DescribeInstanceTypesRequest.builder()
.instanceTypes(InstanceType.M5_LARGE, InstanceType.fromValue("t4g.medium"),
InstanceType.fromValue("m6gd.large"))
.build());
assertThat(resp.instanceTypes()).hasSize(3);
assertThat(resp.instanceTypes()).allSatisfy(instanceType ->
assertThat(instanceType.supportedUsageClassesAsStrings())
.containsExactlyInAnyOrder("on-demand", "spot"));
}
@Test
@Order(7)
@DisplayName("CreateFleet - dry-run and instant on-demand launch")
@@ -95,6 +95,9 @@ public class Ec2InstanceTypeCatalog {
if (instanceType.supportedArchitectures == null || instanceType.supportedArchitectures.isEmpty()) {
throw new IllegalStateException("EC2 instance type catalog entry is missing supportedArchitectures: " + name);
}
if (instanceType.supportedUsageClasses == null || instanceType.supportedUsageClasses.isEmpty()) {
throw new IllegalStateException("EC2 instance type catalog entry is missing supportedUsageClasses: " + name);
}
if (instanceType.encryptionInTransitSupported == null) {
throw new IllegalStateException(
"EC2 instance type catalog entry is missing encryptionInTransitSupported: " + name);
@@ -156,6 +159,7 @@ public class Ec2InstanceTypeCatalog {
public int memoryMib;
public int localStorageGiB;
public List<String> supportedArchitectures = List.of();
public List<String> supportedUsageClasses = List.of("on-demand", "spot");
public Boolean currentGeneration;
public Boolean encryptionInTransitSupported;
public Integer defaultNetworkCardIndex;
@@ -170,6 +174,7 @@ public class Ec2InstanceTypeCatalog {
type.put("instanceStorageSupported", localStorageGiB > 0);
type.put("localStorageGiB", localStorageGiB);
type.put("supportedArchitectures", List.copyOf(supportedArchitectures));
type.put("supportedUsageClasses", List.copyOf(supportedUsageClasses));
type.put("currentGeneration", currentGeneration == null || currentGeneration);
Map<String, Object> networkInfo = new LinkedHashMap<>();
networkInfo.put("encryptionInTransitSupported", encryptionInTransitSupported);
@@ -3849,7 +3849,12 @@ public class Ec2QueryHandler {
for (String arch : (List<String>) t.get("supportedArchitectures")) {
xml.elem("item", arch);
}
xml.end("supportedArchitectures").end("processorInfo");
xml.end("supportedArchitectures").end("processorInfo")
.start("supportedUsageClasses");
for (String usageClass : (List<String>) t.get("supportedUsageClasses")) {
xml.elem("item", usageClass);
}
xml.end("supportedUsageClasses");
Map<String, Object> networkInfo = (Map<String, Object>) t.get("networkInfo");
xml.start("networkInfo")
.elem("encryptionInTransitSupported",
@@ -31,6 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
* <p>Both fields are resolved through the same reference-path resolver a {@code ".$"} payload
* template field uses, so an unresolvable path fails with {@code States.Runtime}, matching the
* precedent set for issue #2521 in {@link AslExecutorUnresolvableJsonPathTest}.
*
* <p>The fixture supplies all service handlers required by the production executor, including
* the SNS handler introduced by the Step Functions SNS integration.
*/
@QuarkusTest
class AslExecutorFailStateErrorCauseTest {