RoutingPolicies { public Map<RoutingPolicyId, RoutingPolicy> get(ApplicationId application) { return db.readRoutingPolicies(application); } RoutingPolicies(Controller controller); Map<RoutingPolicyId, RoutingPolicy> get(ApplicationId application); Map<RoutingPolicyId, RoutingPolicy> get(DeploymentId deployment); ZoneRoutingPolicy get(ZoneId zone); void refresh(ApplicationId application, DeploymentSpec deploymentSpec, ZoneId zone); void setGlobalRoutingStatus(ZoneId zone, GlobalRouting.Status status); void setGlobalRoutingStatus(DeploymentId deployment, GlobalRouting.Status status, GlobalRouting.Agent agent);  }
@Test public void reprovisioning_load_balancer_preserves_cname_record() { var tester = new RoutingPoliciesTester(); var context = tester.newDeploymentContext("tenant1", "app1", "default"); tester.provisionLoadBalancers(1, context.instanceId(), zone1); var applicationPackage = applicationPackageBuilder() .region(zone1.region()) .build(); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.prod).deploy(); var expectedRecords = Set.of( "c0.app1.tenant1.us-west-1.vespa.oath.cloud" ); assertEquals(expectedRecords, tester.recordNames()); assertEquals(1, tester.policiesOf(context.instanceId()).size()); tester.controllerTester().controller().applications().deactivate(context.instanceId(), zone1); tester.controllerTester().configServer().removeLoadBalancers(context.instanceId(), zone1); var newHostname = HostName.from("new-hostname"); var loadBalancer = new LoadBalancer("LB-0-Z-" + zone1.value(), context.instanceId(), ClusterSpec.Id.from("c0"), newHostname, LoadBalancer.State.active, Optional.of("dns-zone-1")); tester.controllerTester().configServer().putLoadBalancers(zone1, List.of(loadBalancer)); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.prod).deploy(); assertEquals(expectedRecords, tester.recordNames()); assertEquals(1, tester.policiesOf(context.instanceId()).size()); assertEquals("CNAME points to current load blancer", newHostname.value() + ".", tester.cnameDataOf(expectedRecords.iterator().next()).get(0)); }