mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): list Aurora engines in DescribeOrderableDBInstanceOptions (#5585)
* fix(rds): list Aurora engines in DescribeOrderableDBInstanceOptions DescribeOrderableDBInstanceOptions returned nothing for aurora-mysql or aurora-postgresql, so clients that pick an instance class from the orderable list could not create Aurora cluster instances. Add the default Aurora MySQL (8.0.mysql_aurora.3.05.2) and Aurora PostgreSQL (16.3) versions with db.t3.medium, db.t4g.medium, db.r5.large and db.r6g.large. * fix(ec2): honour block-device-mapping.volume-type in DescribeImages The filter fell through to the default case and matched every image. Registered images now match on any block device mapping's EBS volume type, mirroring block-device-mapping.snapshot-id. Catalog images model no block devices, so an optional rootVolumeType catalog field carries the type where the AMI name states it (gp2 for the Amazon Linux 2 image, gp3 for the hvm-ssd-gp3 Ubuntu images); images without it match no value. DescribeImages output is unchanged. * fix(rds): report general-public-license for aurora-mysql orderable options * fix(ec2): carry catalog root volume type into the image's EBS mapping * fix(ec2,rds): address review on catalog AMI mappings and Aurora default version - Catalog AMI root mappings no longer advertise an invented SnapshotId that DescribeSnapshots cannot resolve (EbsBlockDevice.SnapshotId is optional); a copy or capture still mints a real root snapshot. - RunInstances sizes the root volume type from the AMI's root mapping, falling back to gp3, so the gp2 catalog AMI launches a gp2 root. - aurora-mysql defaults to 8.0.mysql_aurora.3.05.2, the version DescribeOrderableDBInstanceOptions lists. * test(ec2): assert the volume-type filter, not a single gp2 volume Instances launched earlier in the class now get gp2 roots from the gp2 catalog AMI, so filtering on gp2 returns several volumes. Check every result is gp2 and the created volume is among them. * test(rds): read EngineVersion with XmlPath, import RequestSpecification * fix(ec2): honour a RunInstances root BlockDeviceMapping volume type A request BlockDeviceMapping naming the AMI's root device overrides the AMI's root VolumeType, as on AWS; previously the launch always took the AMI mapping, so a gp3 root on the gp2 Amazon Linux 2 AMI came out gp2. * test: explicit RequestSpecification type in Ec2IntegrationTest (NoVar checkstyle rule) * refactor(ec2): fold RunInstances BlockDeviceMappings into the placement overload Adds the mappings parameter to the existing hostId/tenancy overload instead of a new one, and updates the two callers that named that signature: Ec2RunInstancesPublicIpParamTest's stub/verify (whose unmatched stub returned null and NPE'd the handler) and the dedicated-host race test. * fix(ec2): apply launch template block device mappings and capture the real root type RunInstances and CreateFleet now layer the request's BlockDeviceMappings over the launch template's (a request entry for a device replaces the template's), so a template asking for a gp3 root is honoured instead of the AMI's gp2. CreateImage records the instance's actual root volume type on the new AMI's root mapping rather than the source AMI's. A mapping naming a VolumeType outside the model's enum (standard, io1, io2, gp2, sc1, st1, gp3) is rejected with the same InvalidParameterValue ModifyVolume returns, through one shared check. The RunInstances-only parser is gone: request mappings are read by the launch template parser, which already treats every member as optional. * test(rds): fold the Aurora default-version orderable check into RdsCatalogueReadIntegrationTest * fix(autoscaling): launch group instances with the template's block device mappings Auto Scaling scale-out now hands the launch template's BlockDeviceMappings to runInstances, as RunInstances and CreateFleet do, so a group launched from a template that asks for a gp3 root gets a gp3 root instead of the AMI's type. Mixed-instances templates take the same path; launch configurations pass none. * test(ec2): template devices the request does not name still apply Covers a launch whose request maps only a data device: the template's root mapping still sets the root volume type. Also covers a template naming an unknown VolumeType, which CreateLaunchTemplate stores and the launch rejects; the EC2 docs paragraph now says so and is rewrapped to the file's width. * fix(ec2): merge launch template block device mappings field by field EC2 documents template block device overrides per member: a request entry for a DeviceName the template maps changes only what it sets, and every other member keeps the template's value. The merge replaced the whole entry, so a request that only resized the root dropped a template's gp3. The merged entry is now built from a copy of the template's, overlaid member by member, leaving the stored template untouched.
This commit is contained in:
1 parent
804335d071
commit
025af9d215
21 files changed
+632
-45
No files matched your search
+10
-5
@@ -67,7 +67,8 @@ class AutoScalingCapacitySuspensionTest {
|
||||
when(ec2.describeLaunchTemplateVersions(eq(REGION), eq("lt-original"), isNull(), anyList()))
|
||||
.thenReturn(List.of(template));
|
||||
when(ec2.runInstances(eq(REGION), any(), any(), anyInt(), anyInt(), any(), anyList(), any(), any(),
|
||||
anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull()))
|
||||
anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull(),
|
||||
anyBoolean(), isNull(), isNull(), any()))
|
||||
.thenReturn(reservation("i-replacement"));
|
||||
}
|
||||
|
||||
@@ -83,7 +84,8 @@ class AutoScalingCapacitySuspensionTest {
|
||||
if (paused) {
|
||||
verify(ec2, never()).terminateInstances(anyString(), anyList());
|
||||
verify(ec2, never()).runInstances(eq(REGION), any(), any(), anyInt(), anyInt(), any(), anyList(),
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull());
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull(),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
assertEquals(List.of("i-original"), group.getInstances().stream()
|
||||
.map(AsgInstance::getInstanceId).toList());
|
||||
service.resumeProcesses(REGION, "suspended-group", processes);
|
||||
@@ -94,7 +96,8 @@ class AutoScalingCapacitySuspensionTest {
|
||||
verify(ec2).terminateInstances(REGION, List.of("i-original"));
|
||||
} else {
|
||||
verify(ec2).runInstances(eq(REGION), any(), any(), eq(1), eq(1), any(), anyList(),
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull());
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull(),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +164,8 @@ class AutoScalingCapacitySuspensionTest {
|
||||
clearInvocations(ec2);
|
||||
reconciler.reconcile(group);
|
||||
verify(ec2, never()).runInstances(eq(REGION), any(), any(), anyInt(), anyInt(), any(), anyList(),
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull());
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull(),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
verify(ec2, never()).terminateInstances(anyString(), anyList());
|
||||
} finally {
|
||||
releaseOperation.countDown();
|
||||
@@ -183,7 +187,8 @@ class AutoScalingCapacitySuspensionTest {
|
||||
clearInvocations(ec2);
|
||||
reconciler.reconcile(group);
|
||||
verify(ec2, never()).runInstances(eq(REGION), any(), any(), anyInt(), anyInt(), any(), anyList(),
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull());
|
||||
any(), any(), anyList(), any(), any(), any(), isNull(), eq(0), isNull(), isNull(), isNull(), isNull(),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
if (recreate) {
|
||||
assertTrue(service.describeAutoScalingGroups(REGION, List.of("suspended-group"))
|
||||
.getFirst().getInstances().isEmpty());
|
||||
|
||||
+3
-1
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.anyBoolean;
|
||||
import static org.mockito.Mockito.anyInt;
|
||||
import static org.mockito.Mockito.anyList;
|
||||
import static org.mockito.Mockito.anyString;
|
||||
@@ -354,7 +355,8 @@ class AutoScalingPlacementTest {
|
||||
return List.of(reservation);
|
||||
});
|
||||
when(ec2.runInstances(any(), any(), any(), anyInt(), anyInt(), any(), any(), any(), any(),
|
||||
any(), any(), any(), any(), any(), anyInt(), any(), any(), any(), any())).thenAnswer(call -> {
|
||||
any(), any(), any(), any(), any(), anyInt(), any(), any(), any(), any(),
|
||||
anyBoolean(), any(), any(), any())).thenAnswer(call -> {
|
||||
if (allocations >= failAfter) {
|
||||
if (deleteOnFailure) {
|
||||
groupPresent = false;
|
||||
|
||||
+56
-11
@@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.anyBoolean;
|
||||
import static org.mockito.Mockito.anyList;
|
||||
import static org.mockito.Mockito.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
@@ -129,7 +130,8 @@ class AutoScalingReconcilerTest {
|
||||
verify(service).saveAutoScalingGroupIfPresent(group);
|
||||
verify(service).completeInstanceRefreshIfSettled("us-east-1", "bad-data");
|
||||
verify(ec2, never()).runInstances(any(), any(), any(), any(Integer.class), any(Integer.class), any(),
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any(Integer.class), any(), any(), any(), any());
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any(Integer.class), any(), any(), any(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
}
|
||||
|
||||
static Stream<Arguments> templateUserData() {
|
||||
@@ -190,7 +192,8 @@ class AutoScalingReconcilerTest {
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null),
|
||||
anyList(), eq(expectedText),
|
||||
eq("arn:aws:iam::000000000000:instance-profile/app-profile"), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(expectedEncoding))).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(expectedEncoding),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
@@ -203,7 +206,8 @@ class AutoScalingReconcilerTest {
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null),
|
||||
tags.capture(), eq(expectedText),
|
||||
eq("arn:aws:iam::000000000000:instance-profile/app-profile"), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(expectedEncoding));
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(expectedEncoding),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
assertEquals(storedText, version.getData().getUserData());
|
||||
assertEquals(storedEncoding, version.getData().getEncodedUserData());
|
||||
assertEquals(propagatedTags.size(), tags.getValue().size());
|
||||
@@ -230,7 +234,8 @@ class AutoScalingReconcilerTest {
|
||||
when(ec2Service.runInstances(eq("us-east-1"), eq("ami-version-1"), eq("t3.micro"),
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null), eq(List.of()),
|
||||
eq(null), eq(null), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
@@ -238,6 +243,38 @@ class AutoScalingReconcilerTest {
|
||||
verify(asgService, never()).completeInstanceRefreshIfSettled("us-east-1", "app-asg");
|
||||
}
|
||||
|
||||
@Test
|
||||
void scaleOutPassesTheLaunchTemplateBlockDeviceMappings() {
|
||||
AutoScalingService asgService = scalingService();
|
||||
Ec2Service ec2Service = mock(Ec2Service.class);
|
||||
AutoScalingReconciler reconciler = new AutoScalingReconciler(asgService, ec2Service, mock(ElbV2Service.class));
|
||||
AutoScalingGroup asg = launchTemplateAsg();
|
||||
stubLaunchTemplate(ec2Service, "ami-version-1", "t3.micro");
|
||||
LaunchTemplateData.Ebs ebs = new LaunchTemplateData.Ebs();
|
||||
ebs.setVolumeType("gp3");
|
||||
LaunchTemplateData.BlockDeviceMapping root = new LaunchTemplateData.BlockDeviceMapping();
|
||||
root.setDeviceName("/dev/xvda");
|
||||
root.setEbs(ebs);
|
||||
ec2Service.describeLaunchTemplateVersions("us-east-1", "lt-123", null, List.of("1"))
|
||||
.getFirst().getData().setBlockDeviceMappings(List.of(root));
|
||||
when(asgService.saveAutoScalingGroupIfPresent(asg)).thenReturn(true);
|
||||
Instance ec2Instance = new Instance();
|
||||
ec2Instance.setInstanceId("i-gp3");
|
||||
Reservation reservation = new Reservation();
|
||||
reservation.setInstances(List.of(ec2Instance));
|
||||
when(ec2Service.runInstances(any(), any(), any(), any(Integer.class), any(Integer.class), any(),
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any(Integer.class), any(), any(), any(), any(),
|
||||
anyBoolean(), any(), any(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
ArgumentCaptor<List<LaunchTemplateData.BlockDeviceMapping>> mappings = ArgumentCaptor.captor();
|
||||
verify(ec2Service).runInstances(any(), any(), any(), any(Integer.class), any(Integer.class), any(),
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any(Integer.class), any(), any(), any(), any(),
|
||||
anyBoolean(), any(), any(), mappings.capture());
|
||||
assertEquals(List.of(root), mappings.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scaleOutPersistsInstancesWhenGroupStillExists() {
|
||||
AutoScalingService asgService = scalingService();
|
||||
@@ -255,7 +292,8 @@ class AutoScalingReconcilerTest {
|
||||
when(ec2Service.runInstances(eq("us-east-1"), eq("ami-version-1"), eq("t3.micro"),
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null), eq(List.of()),
|
||||
eq(null), eq(null), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
@@ -300,14 +338,15 @@ class AutoScalingReconcilerTest {
|
||||
when(ec2Service.runInstances(eq("us-east-1"), eq("ami-lc"), eq("t3.micro"),
|
||||
eq(1), eq(1), eq(null), anyList(), eq(null), eq(null),
|
||||
anyList(), eq(null), eq(null), eq(associatePublicIp),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
verify(ec2Service).runInstances(eq("us-east-1"), eq("ami-lc"), eq("t3.micro"),
|
||||
eq(1), eq(1), eq(null), anyList(), eq(null), eq(null),
|
||||
anyList(), eq(null), eq(null), eq(associatePublicIp),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any());
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(), anyBoolean(), isNull(), isNull(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -341,7 +380,8 @@ class AutoScalingReconcilerTest {
|
||||
when(ec2Service.runInstances(eq("us-east-1"), eq("ami-version-7"), eq("t3.micro"),
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null),
|
||||
eq(List.of()), eq(null), eq(null), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
@@ -393,7 +433,8 @@ class AutoScalingReconcilerTest {
|
||||
when(ec2Service.runInstances(eq("us-east-1"), eq("ami-version-3"), eq("t3.small"),
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null),
|
||||
eq(List.of()), eq("#!/bin/bash\necho hi\n"), eq(null), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(reservation);
|
||||
|
||||
reconciler.reconcile(asg);
|
||||
|
||||
@@ -405,7 +446,7 @@ class AutoScalingReconcilerTest {
|
||||
verify(ec2Service).runInstances(eq("us-east-1"), eq("ami-version-3"), eq("t3.small"),
|
||||
eq(1), eq(1), eq(null), eq(List.of()), eq(null), eq(null),
|
||||
eq(List.of()), eq("#!/bin/bash\necho hi\n"), eq(null), eq(null),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any());
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(), anyBoolean(), isNull(), isNull(), any());
|
||||
assertNull(version.getData().getUserData());
|
||||
}
|
||||
|
||||
@@ -477,7 +518,11 @@ class AutoScalingReconcilerTest {
|
||||
org.mockito.ArgumentMatchers.any(),
|
||||
org.mockito.ArgumentMatchers.any(),
|
||||
org.mockito.ArgumentMatchers.any(),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any());
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
|
||||
org.mockito.ArgumentMatchers.anyBoolean(),
|
||||
org.mockito.ArgumentMatchers.isNull(),
|
||||
org.mockito.ArgumentMatchers.isNull(),
|
||||
org.mockito.ArgumentMatchers.any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-2
@@ -103,14 +103,16 @@ class LaunchConfigurationUserDataStorageTest {
|
||||
result.setInstances(List.of(launched));
|
||||
when(ec2.runInstances(eq(REGION), eq("ami-original"), eq("t3.micro"), eq(1), eq(1),
|
||||
isNull(), anyList(), isNull(), isNull(), anyList(), eq(text), isNull(), isNull(),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(encoded))).thenReturn(result);
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(encoded),
|
||||
anyBoolean(), isNull(), isNull(), any())).thenReturn(result);
|
||||
AutoScalingReconciler reconciler = new AutoScalingReconciler(service, ec2, mock(ElbV2Service.class));
|
||||
try {
|
||||
reconciler.reconcile(group);
|
||||
assertEquals(List.of("i-created"), group.getInstances().stream().map(i -> i.getInstanceId()).toList());
|
||||
verify(ec2).runInstances(eq(REGION), eq("ami-original"), eq("t3.micro"), eq(1), eq(1),
|
||||
isNull(), anyList(), isNull(), isNull(), anyList(), eq(text), isNull(), isNull(),
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(encoded));
|
||||
isNull(), eq(0), isNull(), isNull(), isNull(), eq(encoded),
|
||||
anyBoolean(), isNull(), isNull(), any());
|
||||
assertEquals(origin.equals("legacy") ? null : Boolean.TRUE, restored.getUserDataBase64Encoded());
|
||||
assertEquals(origin.equals("legacy") ? input : encoded, restored.getUserData());
|
||||
} finally {
|
||||
|
||||
+46
@@ -185,6 +185,52 @@ class Ec2CreateFleetIntegrationTest {
|
||||
equalTo(CONTRACT_IMAGE_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(6)
|
||||
void createFleetRootVolumeTakesTheLaunchTemplateRootMappingType() {
|
||||
// ami-0abcdef1234567890 is gp2-rooted at /dev/xvda; the template asks for gp3.
|
||||
String templateId = given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
.formParam("LaunchTemplateName", "create-fleet-gp3-root")
|
||||
.formParam("LaunchTemplateData.ImageId", "ami-0abcdef1234567890")
|
||||
.formParam("LaunchTemplateData.InstanceType", "t3.micro")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.DeviceName", "/dev/xvda")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.Ebs.VolumeType", "gp3")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract()
|
||||
.path("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId");
|
||||
|
||||
String instanceId = given()
|
||||
.formParam("Action", "CreateFleet")
|
||||
.formParam("Type", "instant")
|
||||
.formParam("LaunchTemplateConfig.1.LaunchTemplateSpecification.LaunchTemplateId", templateId)
|
||||
.formParam("LaunchTemplateConfig.1.LaunchTemplateSpecification.Version", "1")
|
||||
.formParam("TargetCapacitySpecification.TotalTargetCapacity", "1")
|
||||
.formParam("TargetCapacitySpecification.DefaultTargetCapacityType", "on-demand")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract()
|
||||
.path("CreateFleetResponse.fleetInstanceSet.item.instanceIds.item");
|
||||
|
||||
given()
|
||||
.formParam("Action", "DescribeVolumes")
|
||||
.formParam("Filter.1.Name", "attachment.instance-id")
|
||||
.formParam("Filter.1.Value.1", instanceId)
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("DescribeVolumesResponse.volumeSet.item.volumeType", equalTo("gp3"));
|
||||
}
|
||||
|
||||
private static String createLaunchTemplate() {
|
||||
return given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
|
||||
+3
-1
@@ -18,6 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -42,7 +43,8 @@ class Ec2CreateFleetRollbackTest {
|
||||
anyList(), nullable(String.class), nullable(String.class), anyList(), nullable(String.class),
|
||||
nullable(String.class), nullable(Boolean.class), nullable(String.class), anyInt(),
|
||||
nullable(String.class), nullable(LaunchTemplateData.MetadataOptions.class),
|
||||
nullable(String.class), nullable(String.class)))
|
||||
nullable(String.class), nullable(String.class), eq(false), nullable(String.class),
|
||||
nullable(String.class), anyList()))
|
||||
.thenReturn(reservation("i-first"))
|
||||
.thenReturn(reservation("i-second"))
|
||||
.thenThrow(new AwsException("InvalidSubnetID.NotFound", "launch failed", 400));
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
@@ -4285,7 +4286,11 @@ class Ec2IntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("DescribeVolumesResponse.volumeSet.item.volumeType", equalTo("gp2"));
|
||||
// Earlier tests launch from gp2-rooted catalog AMIs, so the result holds their root
|
||||
// volumes too: assert the filter, not a count.
|
||||
.body("DescribeVolumesResponse.volumeSet.item.findAll { it.volumeType != 'gp2' }.size()", equalTo(0))
|
||||
.body("DescribeVolumesResponse.volumeSet.item.findAll { it.volumeId == '" + volumeId + "' }.size()",
|
||||
equalTo(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -5642,4 +5647,163 @@ class Ec2IntegrationTest {
|
||||
.then()
|
||||
.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(329)
|
||||
void runInstancesRootBlockDeviceMappingOverridesAmiRootVolumeType() {
|
||||
// ami-0abcdef1234567890 is gp2-rooted at /dev/xvda; a root mapping overrides it.
|
||||
assertEquals("gp3", rootVolumeType(launch(Map.of(
|
||||
"BlockDeviceMapping.1.DeviceName", "/dev/xvda",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeSize", "8",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeType", "gp3"))));
|
||||
assertEquals("gp2", rootVolumeType(launch(Map.of())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(330)
|
||||
void runInstancesLaunchTemplateRootMappingOverridesAmiAndYieldsToRequest() {
|
||||
String templateId = given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
.formParam("LaunchTemplateName", "gp3-root-template")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.DeviceName", "/dev/xvda")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.Ebs.VolumeType", "gp3")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId");
|
||||
|
||||
assertEquals("gp3", rootVolumeType(launch(Map.of("LaunchTemplate.LaunchTemplateId", templateId))));
|
||||
// A request mapping for the same device wins over the template's.
|
||||
assertEquals("io1", rootVolumeType(launch(Map.of(
|
||||
"LaunchTemplate.LaunchTemplateId", templateId,
|
||||
"BlockDeviceMapping.1.DeviceName", "/dev/xvda",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeType", "io1"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(331)
|
||||
void runInstancesRejectsAnUnknownBlockDeviceMappingVolumeType() {
|
||||
given()
|
||||
.formParam("Action", "RunInstances")
|
||||
.formParam("ImageId", "ami-0abcdef1234567890")
|
||||
.formParam("InstanceType", "t2.micro")
|
||||
.formParam("MinCount", "1")
|
||||
.formParam("MaxCount", "1")
|
||||
.formParam("BlockDeviceMapping.1.DeviceName", "/dev/xvda")
|
||||
.formParam("BlockDeviceMapping.1.Ebs.VolumeType", "gp9")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>InvalidParameterValue</Code>"))
|
||||
.body(containsString("Value (gp9) for parameter volumeType is invalid. Unknown volume type."));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(332)
|
||||
void runInstancesKeepsTemplateDevicesTheRequestDoesNotName() {
|
||||
String templateId = given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
.formParam("LaunchTemplateName", "gp3-root-data-request-template")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.DeviceName", "/dev/xvda")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.Ebs.VolumeType", "gp3")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId");
|
||||
|
||||
// The request maps only a data device, so the template's root mapping still applies.
|
||||
assertEquals("gp3", rootVolumeType(launch(Map.of(
|
||||
"LaunchTemplate.LaunchTemplateId", templateId,
|
||||
"BlockDeviceMapping.1.DeviceName", "/dev/xvdb",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeSize", "10",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeType", "io1"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(334)
|
||||
void runInstancesRequestEntryForATemplateDeviceChangesOnlyWhatItSets() {
|
||||
String templateId = given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
.formParam("LaunchTemplateName", "gp3-root-size-override-template")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.DeviceName", "/dev/xvda")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.Ebs.VolumeType", "gp3")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId");
|
||||
|
||||
// The request resizes the root but names no type, so the template's gp3 stands.
|
||||
assertEquals("gp3", rootVolumeType(launch(Map.of(
|
||||
"LaunchTemplate.LaunchTemplateId", templateId,
|
||||
"BlockDeviceMapping.1.DeviceName", "/dev/xvda",
|
||||
"BlockDeviceMapping.1.Ebs.VolumeSize", "20"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(333)
|
||||
void launchTemplateWithAnUnknownVolumeTypeIsStoredButFailsAtLaunch() {
|
||||
String templateId = given()
|
||||
.formParam("Action", "CreateLaunchTemplate")
|
||||
.formParam("LaunchTemplateName", "unknown-volume-type-template")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.DeviceName", "/dev/xvdb")
|
||||
.formParam("LaunchTemplateData.BlockDeviceMapping.1.Ebs.VolumeType", "gp9")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId");
|
||||
|
||||
given()
|
||||
.formParam("Action", "RunInstances")
|
||||
.formParam("ImageId", "ami-0abcdef1234567890")
|
||||
.formParam("InstanceType", "t2.micro")
|
||||
.formParam("MinCount", "1")
|
||||
.formParam("MaxCount", "1")
|
||||
.formParam("LaunchTemplate.LaunchTemplateId", templateId)
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>InvalidParameterValue</Code>"))
|
||||
.body(containsString("Value (gp9) for parameter volumeType is invalid. Unknown volume type."));
|
||||
}
|
||||
|
||||
private String launch(Map<String, String> params) {
|
||||
return given()
|
||||
.formParam("Action", "RunInstances")
|
||||
.formParam("ImageId", "ami-0abcdef1234567890")
|
||||
.formParam("InstanceType", "t2.micro")
|
||||
.formParam("MinCount", "1")
|
||||
.formParam("MaxCount", "1")
|
||||
.formParams(params)
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("RunInstancesResponse.instancesSet.item.instanceId");
|
||||
}
|
||||
|
||||
private String rootVolumeType(String instanceId) {
|
||||
return given()
|
||||
.formParam("Action", "DescribeVolumes")
|
||||
.formParam("Filter.1.Name", "attachment.instance-id")
|
||||
.formParam("Filter.1.Value.1", instanceId)
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("DescribeVolumesResponse.volumeSet.item.volumeType");
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -9,6 +9,8 @@ import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
@@ -62,7 +64,7 @@ class Ec2RunInstancesPublicIpParamTest {
|
||||
nullable(String.class), anyList(), nullable(String.class), nullable(String.class),
|
||||
nullable(Boolean.class), nullable(String.class), anyInt(), nullable(String.class),
|
||||
nullable(LaunchTemplateData.MetadataOptions.class), nullable(String.class), nullable(String.class), eq(false),
|
||||
nullable(String.class), nullable(String.class)))
|
||||
nullable(String.class), nullable(String.class), nullable(List.class)))
|
||||
.thenReturn(new Reservation());
|
||||
|
||||
Ec2QueryHandler handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class),
|
||||
@@ -77,7 +79,7 @@ class Ec2RunInstancesPublicIpParamTest {
|
||||
nullable(String.class), anyList(), nullable(String.class), nullable(String.class),
|
||||
associatePublicIp.capture(), nullable(String.class), anyInt(), nullable(String.class),
|
||||
nullable(LaunchTemplateData.MetadataOptions.class), nullable(String.class), nullable(String.class), eq(false),
|
||||
nullable(String.class), nullable(String.class));
|
||||
nullable(String.class), nullable(String.class), nullable(List.class));
|
||||
if (expected == null) {
|
||||
assertNull(associatePublicIp.getValue(),
|
||||
"an absent override must stay null so the subnet default decides");
|
||||
|
||||
@@ -82,6 +82,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@@ -1720,6 +1721,130 @@ class Ec2ServiceTest {
|
||||
"catalog imageOwnerAlias values must not turn arbitrary owner strings into Owners selectors");
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesFiltersCatalogImagesByBlockDeviceMappingVolumeType() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
assertTrue(service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("bogus"))).isEmpty());
|
||||
assertEquals(List.of("ami-0abcdef1234567890"), service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("gp2"))).stream().map(Image::getImageId).toList());
|
||||
assertEquals(Set.of("ami-ubuntu2404-arm64", "ami-ubuntu2404-amd64", "ami-ubuntu2404-cloud-arm64"),
|
||||
service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("gp3"))).stream()
|
||||
.map(Image::getImageId).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void catalogImageSelectedByVolumeTypeReturnsAndCopiesThatMapping() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
Image found = service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("gp2"))).get(0);
|
||||
assertEquals("gp2", found.getBlockDeviceMappings().get(0).getEbs().getVolumeType());
|
||||
|
||||
Image copy = service.copyImage("us-east-1", "us-east-1", found.getImageId(), "copy", null);
|
||||
assertEquals("gp2", copy.getBlockDeviceMappings().get(0).getEbs().getVolumeType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void catalogImageSnapshotIdsResolveThroughDescribeSnapshots() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
Image catalog = service.describeImages("us-east-1", List.of("ami-0abcdef1234567890"), List.of(), Map.of())
|
||||
.getFirst();
|
||||
for (BlockDeviceMapping mapping : catalog.getBlockDeviceMappings()) {
|
||||
String snapshotId = mapping.getEbs().getSnapshotId();
|
||||
if (snapshotId != null) {
|
||||
assertDoesNotThrow(() -> service.describeSnapshots("us-east-1", List.of(snapshotId), null, Map.of()),
|
||||
"catalog AMI advertises snapshot " + snapshotId + " that DescribeSnapshots cannot find");
|
||||
}
|
||||
}
|
||||
|
||||
// A copy's root is still backed by a real snapshot record.
|
||||
Image copy = service.copyImage("us-east-1", "us-east-1", catalog.getImageId(), "copy", null);
|
||||
String copySnapshot = copy.getBlockDeviceMappings().getFirst().getEbs().getSnapshotId();
|
||||
assertEquals(1, service.describeSnapshots("us-east-1", List.of(copySnapshot), null, Map.of()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void runInstancesRootVolumeTakesTheAmiRootVolumeType() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
Instance gp2 = service.runInstances("us-east-1", "ami-0abcdef1234567890", "t3.micro",
|
||||
1, 1, null, List.of(), null, null, List.of(), null, null).getInstances().getFirst();
|
||||
assertEquals("gp2", service.describeVolumes("us-east-1", List.of(gp2.getRootVolumeId()), Map.of())
|
||||
.getFirst().getVolumeType());
|
||||
|
||||
Instance gp3 = service.runInstances("us-east-1", "ami-ubuntu2404-amd64", "t3.micro",
|
||||
1, 1, null, List.of(), null, null, List.of(), null, null).getInstances().getFirst();
|
||||
assertEquals("gp3", service.describeVolumes("us-east-1", List.of(gp3.getRootVolumeId()), Map.of())
|
||||
.getFirst().getVolumeType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createImageRecordsTheInstanceRootVolumeTypeNotTheSourceAmis() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
LaunchTemplateData.Ebs ebs = new LaunchTemplateData.Ebs();
|
||||
ebs.setVolumeType("gp3");
|
||||
LaunchTemplateData.BlockDeviceMapping root = new LaunchTemplateData.BlockDeviceMapping();
|
||||
root.setDeviceName("/dev/xvda");
|
||||
root.setEbs(ebs);
|
||||
|
||||
// ami-0abcdef1234567890 declares a gp2 root; the launch asked for gp3.
|
||||
Instance instance = service.runInstances("us-east-1", "ami-0abcdef1234567890", "t3.micro",
|
||||
1, 1, null, List.of(), null, null, List.of(), null, null, null, null, 0, null, null, null,
|
||||
null, false, null, null, List.of(root)).getInstances().getFirst();
|
||||
String imageId = service.createImage("us-east-1", instance.getInstanceId(), "gp3-capture", null, true)
|
||||
.getImageId();
|
||||
|
||||
Image captured = service.describeImages("us-east-1", List.of(imageId), List.of(), Map.of()).getFirst();
|
||||
BlockDeviceMapping capturedRoot = captured.getBlockDeviceMappings().stream()
|
||||
.filter(m -> "/dev/xvda".equals(m.getDeviceName()))
|
||||
.findFirst().orElseThrow();
|
||||
assertEquals("gp3", capturedRoot.getEbs().getVolumeType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesFiltersRegisteredImagesByBlockDeviceMappingVolumeType() {
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
mock(AmiImageResolver.class), mock(Ec2ImageCatalog.class), new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
EbsBlockDevice ebs = new EbsBlockDevice();
|
||||
ebs.setVolumeType("io2");
|
||||
BlockDeviceMapping mapping = new BlockDeviceMapping();
|
||||
mapping.setDeviceName("/dev/sda1");
|
||||
mapping.setEbs(ebs);
|
||||
Image io2 = service.registerImage("us-east-1", "io2-image", null, null, null, List.of(mapping));
|
||||
service.registerImage("us-east-1", "no-ebs-image", null, null, null, List.of());
|
||||
|
||||
assertEquals(List.of(io2.getImageId()), service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("io2"))).stream().map(Image::getImageId).toList());
|
||||
assertTrue(service.describeImages("us-east-1", List.of(), List.of(),
|
||||
Map.of("block-device-mapping.volume-type", List.of("gp3"))).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesMatchesCatalogAliasInImageIdFilter() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
@@ -5930,7 +6055,7 @@ class Ec2ServiceTest {
|
||||
|
||||
AwsException e = assertThrows(AwsException.class, () -> service.runInstances("us-east-1",
|
||||
"ami-ubuntu2404-amd64", "m5.large", 1, 1, null, List.of(), null, null, List.of(), null, null,
|
||||
null, null, 0, null, null, null, null, false, hostId[0], null));
|
||||
null, null, 0, null, null, null, null, false, hostId[0], null, null));
|
||||
|
||||
assertTrue(released[0], "the hook must have released the host between the two checks");
|
||||
assertEquals("InvalidHostID.NotFound", e.getErrorCode());
|
||||
|
||||
+4
@@ -150,6 +150,10 @@ class RdsCatalogueReadIntegrationTest {
|
||||
.extract().xmlPath().getString("CreateDBClusterResponse.CreateDBClusterResult.DBCluster.EngineVersion");
|
||||
assertEquals(expected, created);
|
||||
assertEquals(defaultVersion(engine), created);
|
||||
// A caller sizing instances for the cluster must find an orderable class at that version.
|
||||
query("DescribeOrderableDBInstanceOptions").formParam("Engine", engine).formParam("EngineVersion", created)
|
||||
.when().post("/").then().statusCode(200)
|
||||
.body(containsString("<OrderableDBInstanceOption>"));
|
||||
query("DeleteDBCluster").formParam("DBClusterIdentifier", id).formParam("SkipFinalSnapshot", "true")
|
||||
.when().post("/").then().statusCode(200);
|
||||
}
|
||||
|
||||
@@ -1012,6 +1012,22 @@ class RdsQueryHandlerTest {
|
||||
assertTrue(body.contains("<DBInstanceClass>db.t4g.medium</DBInstanceClass>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeOrderableDbInstanceOptions_auroraMysqlReportsGeneralPublicLicense() {
|
||||
when(service.describeOrderableDbInstanceOptions("aurora-mysql", null, null))
|
||||
.thenReturn(List.of(Map.of(
|
||||
"engine", "aurora-mysql",
|
||||
"engineVersion", "8.0.mysql_aurora.3.05.2",
|
||||
"dbInstanceClass", "db.r5.large")));
|
||||
|
||||
MultivaluedMap<String, String> p = params();
|
||||
p.add("Engine", "aurora-mysql");
|
||||
String body = (String) handler.handle("DescribeOrderableDBInstanceOptions", p).getEntity();
|
||||
|
||||
assertTrue(body.contains("<LicenseModel>general-public-license</LicenseModel>"));
|
||||
assertFalse(body.contains("postgresql-license"));
|
||||
}
|
||||
|
||||
// ──────────────────────────── DBParameterGroups XML tag ──────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
@@ -2992,6 +2992,23 @@ class RdsServiceTest {
|
||||
assertEquals("16.14", result.getFirst().get("engineVersion"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeOrderableDbInstanceOptionsListsAuroraEngines() {
|
||||
List<String> auroraClasses = List.of("db.t3.medium", "db.t4g.medium", "db.r5.large", "db.r6g.large");
|
||||
|
||||
List<Map<String, String>> mysql = rdsService.describeOrderableDbInstanceOptions("aurora-mysql", null, null);
|
||||
List<Map<String, String>> postgres = rdsService.describeOrderableDbInstanceOptions("aurora-postgresql", null, null);
|
||||
|
||||
assertEquals(auroraClasses, mysql.stream().map(o -> o.get("dbInstanceClass")).toList());
|
||||
assertTrue(mysql.stream().allMatch(o -> "aurora-mysql".equals(o.get("engine"))
|
||||
&& "8.0.mysql_aurora.3.05.2".equals(o.get("engineVersion"))));
|
||||
assertEquals(auroraClasses, postgres.stream().map(o -> o.get("dbInstanceClass")).toList());
|
||||
assertTrue(postgres.stream().allMatch(o -> "aurora-postgresql".equals(o.get("engine"))
|
||||
&& "16.3".equals(o.get("engineVersion"))));
|
||||
assertEquals(1, rdsService.describeOrderableDbInstanceOptions(
|
||||
"aurora-postgresql", "16.3", "db.r6g.large").size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteDbClusterFailsWhenMembersRemain() {
|
||||
DbCluster cluster = rdsService.createDbCluster("cluster1", "postgres", "13",
|
||||
|
||||
Reference in new issue
Block a user