@Test public void expire_reserved() { LoadBalancerExpirer expirer = new LoadBalancerExpirer(tester.nodeRepository(), Duration.ofDays(1), tester.loadBalancerService(), new TestMetric()); Supplier<Map<LoadBalancerId, LoadBalancer>> loadBalancers = () -> tester.nodeRepository().database().readLoadBalancers((ignored) -> true); ClusterSpec.Id cluster = ClusterSpec.Id.from("qrs"); ApplicationId app = ProvisioningTester.makeApplicationId(); LoadBalancerId lb = new LoadBalancerId(app, cluster); deployApplication(app, false, cluster); assertSame(LoadBalancer.State.reserved, loadBalancers.get().get(lb).state()); expirer.maintain(); assertSame(LoadBalancer.State.reserved, loadBalancers.get().get(lb).state()); dirtyNodesOf(app, cluster); tester.clock().advance(Duration.ofHours(1).plus(Duration.ofSeconds(1))); expirer.maintain(); assertSame(LoadBalancer.State.inactive, loadBalancers.get().get(lb).state()); expirer.maintain(); assertSame(LoadBalancer.State.inactive, loadBalancers.get().get(lb).state()); tester.clock().advance(Duration.ofHours(1).plus(Duration.ofSeconds(1))); expirer.maintain(); assertFalse("Inactive load balancer removed", loadBalancers.get().containsKey(lb)); }
@Override protected boolean maintain() { expireReserved(); return removeInactive() & pruneReals(); }
LoadBalancerExpirer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { expireReserved(); return removeInactive() & pruneReals(); } }
LoadBalancerExpirer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { expireReserved(); return removeInactive() & pruneReals(); } LoadBalancerExpirer(NodeRepository nodeRepository, Duration interval, LoadBalancerService service, Metric metric); }
LoadBalancerExpirer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { expireReserved(); return removeInactive() & pruneReals(); } LoadBalancerExpirer(NodeRepository nodeRepository, Duration interval, LoadBalancerService service, Metric metric);  }
LoadBalancerExpirer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { expireReserved(); return removeInactive() & pruneReals(); } LoadBalancerExpirer(NodeRepository nodeRepository, Duration interval, LoadBalancerService service, Metric metric);   }