mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(ec2): answer DescribeTransitGatewayConnects with an empty list (#3274)
* fix(ec2): answer DescribeTransitGatewayConnects with an empty list LZA's tgw-associations-and-propagations module calls this unconditionally alongside DescribeTransitGatewayVpcAttachments. floci does not yet support creating Connect attachments, so the action was entirely unhandled and the module failed with "Operation DescribeTransitGatewayConnects is not supported", found while running LZA phase2 against parent 1176. Since floci has no Connect attachments to return, an empty list is the wire-faithful answer for every account. Requested attachment ids still validate against the shared tgw-attach- id namespace: malformed ids reuse the existing InvalidTransitGatewayAttachmentID.Malformed check, well-formed but unknown ids get InvalidTransitGatewayConnectID.NotFound. * test(ec2): cover DescribeTransitGatewayConnects over the Query protocol and make the service hook void The service method only validates the request; the handler always renders an empty transitGatewayConnectSet, so returning a List of VPC attachments suggested a resource type it never produces. It is void now. Two integration tests drive the action through the EC2 Query dispatch and pin the response wire shape (EC2 namespace, requestId, empty transitGatewayConnectSet) and the Malformed / Connect NotFound error codes.
This commit is contained in:
1 parent
c57b8ff5f6
commit
f30ba77ac0
5 files changed
+96
No files matched your search
@@ -50,6 +50,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
@@ -2598,6 +2599,32 @@ class Ec2ServiceTest {
|
||||
"a well-formed id that does not exist is a different failure");
|
||||
}
|
||||
|
||||
/**
|
||||
* floci does not yet support creating Connect attachments, so LZA's tgw-associations-and-
|
||||
* propagations module, which describes them unconditionally alongside VPC attachments, needs
|
||||
* this to at least answer with an empty account-wide list rather than an unrecognized-action
|
||||
* error (LZA fidelity gap: AWSAccelerator-ToolkitProject build 29 failed with "Operation
|
||||
* DescribeTransitGatewayConnects is not supported").
|
||||
*/
|
||||
@Test
|
||||
void describeTransitGatewayConnectsReturnsEmptyWhenNoneExist() {
|
||||
Ec2Service service = prefixListService();
|
||||
|
||||
assertDoesNotThrow(() -> service.describeTransitGatewayConnects("us-east-1", List.of(), Map.of()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeTransitGatewayConnectsRejectsAMalformedOrUnknownId() {
|
||||
Ec2Service service = prefixListService();
|
||||
|
||||
assertEquals("InvalidTransitGatewayAttachmentID.Malformed", assertThrows(AwsException.class,
|
||||
() -> service.describeTransitGatewayConnects("us-east-1", List.of("tgw-connect-nope"), Map.of()))
|
||||
.getErrorCode());
|
||||
assertEquals("InvalidTransitGatewayConnectID.NotFound", assertThrows(AwsException.class,
|
||||
() -> service.describeTransitGatewayConnects("us-east-1",
|
||||
List.of("tgw-attach-0123456789abcdef0"), Map.of())).getErrorCode());
|
||||
}
|
||||
|
||||
/** The gateway's owner is its own field, sourced from the gateway rather than from the VPC. */
|
||||
@Test
|
||||
void anAttachmentRecordsBothOwnersSeparately() {
|
||||
|
||||
+39
@@ -205,4 +205,43 @@ class Ec2TransitGatewayVpcAttachmentIntegrationTest {
|
||||
.then().statusCode(200)
|
||||
.body("DeleteTransitGatewayResponse.transitGateway.state", equalTo("deleted"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect attachments cannot be created yet, so the describe answers with the AWS-shaped
|
||||
* empty collection: the EC2 namespace, a requestId, and an empty transitGatewayConnectSet.
|
||||
*/
|
||||
@Test
|
||||
@Order(7)
|
||||
void describeTransitGatewayConnectsAnswersAnEmptySetOverTheQueryProtocol() {
|
||||
String body = given()
|
||||
.formParam("Action", "DescribeTransitGatewayConnects")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when().post("/")
|
||||
.then().statusCode(200)
|
||||
.body("DescribeTransitGatewayConnectsResponse.requestId", not(equalTo("")))
|
||||
.extract().asString();
|
||||
|
||||
assertThat(body, containsString("<DescribeTransitGatewayConnectsResponse xmlns=\"http://ec2.amazonaws.com/doc/2016-11-15/\">"));
|
||||
assertThat(body, containsString("<transitGatewayConnectSet></transitGatewayConnectSet>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(8)
|
||||
void describeTransitGatewayConnectsRejectsMalformedAndUnknownIdsOverTheQueryProtocol() {
|
||||
given()
|
||||
.formParam("Action", "DescribeTransitGatewayConnects")
|
||||
.formParam("TransitGatewayAttachmentIds.1", "tgw-connect-nope")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when().post("/")
|
||||
.then().statusCode(400)
|
||||
.body("Response.Errors.Error.Code", equalTo("InvalidTransitGatewayAttachmentID.Malformed"));
|
||||
|
||||
given()
|
||||
.formParam("Action", "DescribeTransitGatewayConnects")
|
||||
.formParam("TransitGatewayAttachmentIds.1", "tgw-attach-0123456789abcdef0")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when().post("/")
|
||||
.then().statusCode(400)
|
||||
.body("Response.Errors.Error.Code", equalTo("InvalidTransitGatewayConnectID.NotFound"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user