mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(elbv2): stop mutating immutable fallbacks on the delete paths (#4030)
DeleteListener and DeleteLoadBalancer took their region map with getOrDefault(region, Map.of()) and then removed from it. For a region that has no map yet, that removes from the immutable Map.of() sentinel and throws UnsupportedOperationException, which the Query path reports as InternalFailure with a null message. The Terraform AWS provider treats InternalFailure as retryable, so a teardown against an untouched region polls "Still destroying..." instead of failing. Both methods now look the region map up and return when it is absent, which is the same no-op AWS performs for a resource that is not there. The listener and rule maps that the cascade writes back use computeIfAbsent, matching the create paths: getOrDefault would have stored the immutable sentinel as the region's value, so every later call for that region would fail the same way, including CreateListener. The two ARN indexes had the same defect with List.of(), so the removal goes through a helper that looks the list up instead.
This commit is contained in:
1 parent
628952ecf0
commit
a0089b3548
2 files changed
+48
-8
No files matched your search
@@ -251,6 +251,28 @@ class ElbV2ServiceTest {
|
||||
assertEquals(listenerArn, listenerCaptor.getValue().getListenerArn());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteListenerIsIgnoredForRegionWithNoListeners() {
|
||||
String emptyRegion = "eu-central-1";
|
||||
|
||||
service.deleteListener(emptyRegion, "arn:aws:elasticloadbalancing:" + emptyRegion
|
||||
+ ":000000000000:listener/app/sample-lb/1111111111111111/2222222222222222");
|
||||
|
||||
assertTrue(service.describeListeners(emptyRegion, null, null).isEmpty());
|
||||
verifyNoInteractions(dataPlane);
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteLoadBalancerIsIgnoredForRegionWithNoLoadBalancers() {
|
||||
String emptyRegion = "eu-central-1";
|
||||
|
||||
service.deleteLoadBalancer(emptyRegion, "arn:aws:elasticloadbalancing:" + emptyRegion
|
||||
+ ":000000000000:loadbalancer/app/sample-lb/1111111111111111");
|
||||
|
||||
assertTrue(service.describeLoadBalancers(emptyRegion, null, null, null, null).isEmpty());
|
||||
verifyNoInteractions(dataPlane);
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeTargetHealthReturnsUnusedForExplicitUnregisteredTarget() {
|
||||
String tgArn = createTargetGroup("sample-tg");
|
||||
|
||||
Reference in new issue
Block a user