mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(ec2): return an empty set for DescribeVpnGateways (#1975)
* feat(ec2): return an empty set for DescribeVpnGateways There is no VPN gateway model, so an empty vpnGatewaySet is AWS-accurate for an account without VPN gateways. Unblocks the CDK CLI's VPC context provider (Vpc.fromLookup), which always issues this describe and aborts the whole lookup on UnsupportedOperation. Fixes #1974 * test(ec2): assert the vpn gateway set is empty, not merely present The substring check passed for any response containing <vpnGatewaySet, including a non-empty one, so it did not pin the empty-result contract. Uses the item count, matching the other empty EC2 collection tests.
This commit is contained in:
1 parent
a01b707bdc
commit
3baf4f4849
2 files changed
+31
No files matched your search
@@ -111,6 +111,11 @@ public class Ec2QueryHandler {
|
||||
case "DeleteInternetGateway" -> handleDeleteInternetGateway(params, region);
|
||||
case "AttachInternetGateway" -> handleAttachInternetGateway(params, region);
|
||||
case "DetachInternetGateway" -> handleDetachInternetGateway(params, region);
|
||||
// VPN Gateways. There is no VPN gateway model; an empty set is
|
||||
// AWS-accurate for an account without VPN gateways and unblocks the
|
||||
// CDK VPC context provider, which always issues this describe.
|
||||
case "DescribeVpnGateways" -> handleDescribeVpnGateways();
|
||||
|
||||
// Route Tables
|
||||
case "CreateRouteTable" -> handleCreateRouteTable(params, region);
|
||||
case "DescribeRouteTables" -> handleDescribeRouteTables(params, region);
|
||||
@@ -1435,6 +1440,16 @@ public class Ec2QueryHandler {
|
||||
return xmlResponse(xml.build());
|
||||
}
|
||||
|
||||
private Response handleDescribeVpnGateways() {
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.start("DescribeVpnGatewaysResponse", AwsNamespaces.EC2)
|
||||
.elem("requestId", UUID.randomUUID().toString())
|
||||
.start("vpnGatewaySet")
|
||||
.end("vpnGatewaySet")
|
||||
.end("DescribeVpnGatewaysResponse");
|
||||
return xmlResponse(xml.build());
|
||||
}
|
||||
|
||||
private Response handleDescribeRouteTables(MultivaluedMap<String, String> p, String region) {
|
||||
List<String> ids = getList(p, "RouteTableId");
|
||||
Map<String, List<String>> filters = getFilters(p);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package io.github.hectorvent.floci.services.ec2;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.everyItem;
|
||||
@@ -1304,6 +1306,20 @@ class Ec2IntegrationTest {
|
||||
.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(52)
|
||||
void describeVpnGatewaysReturnsEmptySet() {
|
||||
given()
|
||||
.formParam("Action", "DescribeVpnGateways")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("DescribeVpnGatewaysResponse.vpnGatewaySet.item.size()", equalTo(0))
|
||||
.body(not(containsString("UnsupportedOperation")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(52)
|
||||
void describeInternetGateways() {
|
||||
|
||||
Reference in new issue
Block a user