diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java index 259a6bd970..78808ebcce 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java @@ -969,6 +969,51 @@ class Ec2Tests { @Test @Order(50) + @DisplayName("DescribeVpcEndpoints - an interface endpoint reports its network interfaces") + void describeVpcEndpointsReportsNetworkInterfaceIds() { + // The wire element is networkInterfaceIdSet, and the point of asserting it HERE + // rather than only over raw XML is that this proves the real Java SDK deserializes + // it into networkInterfaceIds(). A response can be well-formed XML and still not + // populate the SDK model -- a wrong element name or nesting fails silently, leaving + // an empty list rather than an error, which is exactly the symptom being fixed. + String endpointId = null; + try { + CreateVpcEndpointResponse created = ec2.createVpcEndpoint( + CreateVpcEndpointRequest.builder() + .vpcId(vpcId) + .serviceName("com.amazonaws.us-east-1.ec2") + .vpcEndpointType(VpcEndpointType.INTERFACE) + .subnetIds(subnetId) + .build()); + endpointId = created.vpcEndpoint().vpcEndpointId(); + + // Asserted on the CREATE response and again on DESCRIBE, because Terraform + // reads the ids from one and then re-reads them from the other between plan + // and apply; both renderings have to agree. + assertThat(created.vpcEndpoint().networkInterfaceIds()) + .as("CreateVpcEndpoint response") + .hasSize(1) + .allMatch(id -> id.matches("eni-[0-9a-f]{17}")); + + DescribeVpcEndpointsResponse described = ec2.describeVpcEndpoints( + DescribeVpcEndpointsRequest.builder().vpcEndpointIds(endpointId).build()); + VpcEndpoint ep = described.vpcEndpoints().get(0); + + assertThat(ep.networkInterfaceIds()) + .as("DescribeVpcEndpoints response") + .isEqualTo(created.vpcEndpoint().networkInterfaceIds()); + assertThat(ep.groups()).isNotEmpty(); + assertThat(ep.dnsEntries()).isNotEmpty(); + } finally { + if (endpointId != null) { + ec2.deleteVpcEndpoints(DeleteVpcEndpointsRequest.builder() + .vpcEndpointIds(endpointId).build()); + } + } + } + + @Test + @Order(51) @DisplayName("DeleteVpc - delete VPC") void deleteVpc() { ec2.deleteVpc(DeleteVpcRequest.builder().vpcId(vpcId).build());