Previously, name and ubid lookups operated differently. For name lookups, we would use a typical Sequel dataset lookup, including both name and location. For ubid lookups, we would lookup the object by id, and then check that the returned object has the correct location. This changes the ubid lookup to be more like the name lookup, and has code shared for both. The only difference is the column and value used in the dataset lookup filter. For LoadBalancer lookups, this provides a more significant simplification. Instead to iterating over the private subnets, and then iterating over the load balancers in each private subnet (an N+1 query issue), this uses a simple subquery filter when looking up the load balancer, to insure the load balancer is related to a private subnet for the current location. This change broke four postgres tests that use mocking. Three of the tests can be made simliar by just saving the related object to the database and removing the mocking. The final one requires significantly more work as it needs to setup a failover server, and that requires mocking to avoid attempting running a query on a failover server that doesn't actually exist. This adds UBID.to_uuid to convert UBID strings to UUID strings, and uses that for the lookups by ubid.
8.1 KiB
8.1 KiB