mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
* test(elbv2): cover SetSubnets with neither Subnets nor SubnetMappings SetSubnets takes Subnets or SubnetMappings, and AWS refuses a request with neither. These tests pin that answer, which Floci does not give yet: a ValidationError with the CreateLoadBalancer message for the balancer's type, with the balancer left on its subnets and in its VPC, whether the two lists are left out or sent empty. They fail until the fix that follows. They also pin the paths that must keep working: a balancer that does not exist is reported first, a CloudFormation update that names neither leaves its kept balancer alone, and a rollback can still move a balancer an earlier version saved without subnets back onto none. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(elbv2): refuse SetSubnets with neither Subnets nor SubnetMappings A SetSubnets that named neither Subnets nor SubnetMappings answered success and left the load balancer in no Availability Zone, still in its VPC. The API reference says the request takes one or the other, and AWS answers a Network Load Balancer's with "ValidationError: At least one subnet must be specified", the message CreateLoadBalancer gives it. SetSubnets with neither now answers ValidationError and leaves the balancer on its subnets, with the message CreateLoadBalancer gives the balancer's type: "At least two subnets in two different Availability Zones must be specified" for an Application Load Balancer, "At least one subnet must be specified" for a Network or Gateway Load Balancer. A balancer that does not exist is still LoadBalancerNotFound, since the message depends on its type, and a request that names subnets is checked as before. The check runs in the new ElbV2Service.setRequestedSubnets, which the Query handler calls. ElbV2Service.setSubnets still takes an empty list: CloudFormation moves a kept balancer through it, never onto none on an update, and onto none on a rollback only for a balancer an earlier version saved without subnets, which rolls back as before. Follow-up to #6087. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * refactor(elbv2): keep the SetSubnets action check in the package Review follow-ups, no change in behaviour: - The action's entry point is now the package-private ElbV2Service.setSubnetsFromRequest, which only the Query handler calls; setRequestedSubnets read like a property setter. The CloudFormation provisioner, in another package, cannot reach it and keeps moving balancers through setSubnets. - Its Javadoc says why only an empty list is refused there: a request that names subnets is checked by setSubnets. The setSubnets and test Javadocs speak of a balancer an earlier Floci version saved without subnets. - The provisioner test of an update that names neither says the real reason the update must not call setSubnets: it would move the balancer onto none. - The docs line for SetSubnets gives both messages. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(elbv2): give the SetSubnets neither test the class's last order #6098 adds a test at @Order(79) earlier in ElbV2IntegrationTest, while this one stays the last method in the file at @Order(78). Once both land, whoever appends a test would read 78 and pick 79, so this one takes 80 and the last method keeps the highest order. The two tests are independent, so the order between them does not matter. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(elbv2): give the SetSubnets compat test its own order setSubnetsWithoutSubnets and createLoadBalancerWithoutSubnets in the compatibility suite's ElbV2Test both carried @Order(6), so JUnit's order between them was left to its tie-break. The SetSubnets test now has @Order(8), the first value not taken once #6098's @Order(7) test is in the class, so every order in the class is unique. The test stays where it is in the file: moving it below the create test would edit the lines #6098 added on main. The two tests create and delete their own balancers, so neither depends on running before the other. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>