diff options
11 files changed, 76 insertions, 72 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java index 964c2ece524..d9a88f665c7 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java @@ -1,9 +1,12 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration; +import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService; +import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer; import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; +import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; /** * This provides access to all service dependencies of the controller. Implementations of this are responsible for @@ -20,4 +23,10 @@ public interface ServiceRegistry { GlobalRoutingService globalRoutingService(); + RoutingGenerator routingGenerator(); + + Mailer mailer(); + + ApplicationCertificateProvider applicationCertificateProvider(); + } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index f40db70669f..3e4e2780ff9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -30,7 +30,6 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname; import com.yahoo.vespa.hosted.controller.api.identifiers.RevisionId; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificate; -import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint; @@ -125,30 +124,26 @@ public class ApplicationController { private final Clock clock; private final DeploymentTrigger deploymentTrigger; private final BooleanFlag provisionApplicationCertificate; - private final ApplicationCertificateProvider applicationCertificateProvider; private final DeploymentSpecValidator deploymentSpecValidator; ApplicationController(Controller controller, CuratorDb curator, AccessControl accessControl, RotationsConfig rotationsConfig, - ConfigServer configServer, ArtifactRepository artifactRepository, ApplicationStore applicationStore, - RoutingGenerator routingGenerator, BuildService buildService, Clock clock) { + BuildService buildService, Clock clock) { this.controller = controller; this.curator = curator; this.accessControl = accessControl; - this.configServer = configServer; - this.routingGenerator = routingGenerator; - this.routingPolicies = new RoutingPolicies(controller); + this.configServer = controller.serviceRegistry().configServer(); + this.routingGenerator = controller.serviceRegistry().routingGenerator(); this.clock = clock; - this.artifactRepository = artifactRepository; this.applicationStore = applicationStore; - this.rotationRepository = new RotationRepository(rotationsConfig, this, curator); - this.deploymentTrigger = new DeploymentTrigger(controller, buildService, clock); - this.provisionApplicationCertificate = Flags.PROVISION_APPLICATION_CERTIFICATE.bindTo(controller.flagSource()); - this.applicationCertificateProvider = controller.applicationCertificateProvider(); - this.deploymentSpecValidator = new DeploymentSpecValidator(controller); + routingPolicies = new RoutingPolicies(controller); + rotationRepository = new RotationRepository(rotationsConfig, this, curator); + deploymentTrigger = new DeploymentTrigger(controller, buildService, clock); + provisionApplicationCertificate = Flags.PROVISION_APPLICATION_CERTIFICATE.bindTo(controller.flagSource()); + deploymentSpecValidator = new DeploymentSpecValidator(controller); // Update serialization format of all applications Once.after(Duration.ofMinutes(1), () -> { @@ -512,7 +507,7 @@ public class ApplicationController { if(applicationCertificate.isPresent()) return applicationCertificate; - ApplicationCertificate newCertificate = applicationCertificateProvider.requestCaSignedCertificate(application.id()); + ApplicationCertificate newCertificate = controller.serviceRegistry().applicationCertificateProvider().requestCaSignedCertificate(application.id()); curator.writeApplicationCertificate(application.id(), newCertificate); return Optional.of(newCertificate); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index 707da83ac83..6e3870e6715 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -14,15 +14,12 @@ import com.yahoo.vespa.flags.FlagSource; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore; import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry; -import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud; import com.yahoo.vespa.hosted.controller.api.integration.maven.MavenRepository; import com.yahoo.vespa.hosted.controller.api.integration.metrics.MetricsService; -import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer; import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient; -import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; import com.yahoo.vespa.hosted.controller.api.integration.user.Roles; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import com.yahoo.vespa.hosted.controller.api.role.ApplicationRole; @@ -78,11 +75,9 @@ public class Controller extends AbstractComponent { private final ZoneRegistry zoneRegistry; private final ServiceRegistry serviceRegistry; private final MetricsService metricsService; - private final Mailer mailer; private final AuditLogger auditLogger; private final FlagSource flagSource; private final NameServiceForwarder nameServiceForwarder; - private final ApplicationCertificateProvider applicationCertificateProvider; private final MavenRepository mavenRepository; private final MeteringClient meteringClient; @@ -94,28 +89,27 @@ public class Controller extends AbstractComponent { @Inject public Controller(CuratorDb curator, RotationsConfig rotationsConfig, ZoneRegistry zoneRegistry, MetricsService metricsService, - RoutingGenerator routingGenerator, AccessControl accessControl, ArtifactRepository artifactRepository, ApplicationStore applicationStore, TesterCloud testerCloud, - BuildService buildService, RunDataStore runDataStore, Mailer mailer, FlagSource flagSource, - MavenRepository mavenRepository, ApplicationCertificateProvider applicationCertificateProvider, + BuildService buildService, RunDataStore runDataStore, FlagSource flagSource, + MavenRepository mavenRepository, MeteringClient meteringClient, ServiceRegistry serviceRegistry) { this(curator, rotationsConfig, zoneRegistry, - metricsService, routingGenerator, + metricsService, Clock.systemUTC(), accessControl, artifactRepository, applicationStore, testerCloud, - buildService, runDataStore, com.yahoo.net.HostName::getLocalhost, mailer, flagSource, - mavenRepository, applicationCertificateProvider, meteringClient, serviceRegistry); + buildService, runDataStore, com.yahoo.net.HostName::getLocalhost, flagSource, + mavenRepository, meteringClient, serviceRegistry); } public Controller(CuratorDb curator, RotationsConfig rotationsConfig, ZoneRegistry zoneRegistry, MetricsService metricsService, - RoutingGenerator routingGenerator, Clock clock, + Clock clock, AccessControl accessControl, ArtifactRepository artifactRepository, ApplicationStore applicationStore, TesterCloud testerCloud, BuildService buildService, RunDataStore runDataStore, Supplier<String> hostnameSupplier, - Mailer mailer, FlagSource flagSource, MavenRepository mavenRepository, - ApplicationCertificateProvider applicationCertificateProvider, MeteringClient meteringClient, + FlagSource flagSource, MavenRepository mavenRepository, + MeteringClient meteringClient, ServiceRegistry serviceRegistry) { this.hostnameSupplier = Objects.requireNonNull(hostnameSupplier, "HostnameSupplier cannot be null"); @@ -124,9 +118,7 @@ public class Controller extends AbstractComponent { this.serviceRegistry = Objects.requireNonNull(serviceRegistry, "ServiceRegistry cannot be null"); this.metricsService = Objects.requireNonNull(metricsService, "MetricsService cannot be null"); this.clock = Objects.requireNonNull(clock, "Clock cannot be null"); - this.mailer = Objects.requireNonNull(mailer, "Mailer cannot be null"); this.flagSource = Objects.requireNonNull(flagSource, "FlagSource cannot be null"); - this.applicationCertificateProvider = Objects.requireNonNull(applicationCertificateProvider); this.mavenRepository = Objects.requireNonNull(mavenRepository, "MavenRepository cannot be null"); this.meteringClient = Objects.requireNonNull(meteringClient, "MeteringClient cannot be null"); @@ -134,10 +126,8 @@ public class Controller extends AbstractComponent { jobController = new JobController(this, runDataStore, Objects.requireNonNull(testerCloud)); applicationController = new ApplicationController(this, curator, accessControl, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"), - serviceRegistry.configServer(), Objects.requireNonNull(artifactRepository, "ArtifactRepository cannot be null"), Objects.requireNonNull(applicationStore, "ApplicationStore cannot be null"), - Objects.requireNonNull(routingGenerator, "RoutingGenerator cannot be null"), Objects.requireNonNull(buildService, "BuildService cannot be null"), clock ); @@ -164,10 +154,6 @@ public class Controller extends AbstractComponent { return serviceRegistry; } - public Mailer mailer() { - return mailer; - } - /** Provides access to the feature flags of this */ public FlagSource flagSource() { return flagSource; @@ -300,10 +286,6 @@ public class Controller extends AbstractComponent { return auditLogger; } - public ApplicationCertificateProvider applicationCertificateProvider() { - return applicationCertificateProvider; - } - public MeteringClient meteringClient() { return meteringClient; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index ee5d0a9cd9c..8aa640a6882 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -546,15 +546,15 @@ public class InternalStepRunner implements StepRunner { try { if (run.status() == outOfCapacity && run.id().type().isProduction()) - controller.mailer().send(mails.outOfCapacity(run.id(), recipients)); + controller.serviceRegistry().mailer().send(mails.outOfCapacity(run.id(), recipients)); if (run.status() == deploymentFailed) - controller.mailer().send(mails.deploymentFailure(run.id(), recipients)); + controller.serviceRegistry().mailer().send(mails.deploymentFailure(run.id(), recipients)); if (run.status() == installationFailed) - controller.mailer().send(mails.installationFailure(run.id(), recipients)); + controller.serviceRegistry().mailer().send(mails.installationFailure(run.id(), recipients)); if (run.status() == testFailure) - controller.mailer().send(mails.testFailure(run.id(), recipients)); + controller.serviceRegistry().mailer().send(mails.testFailure(run.id(), recipients)); if (run.status() == error) - controller.mailer().send(mails.systemError(run.id(), recipients)); + controller.serviceRegistry().mailer().send(mails.systemError(run.id(), recipients)); } catch (RuntimeException e) { logger.log(INFO, "Exception trying to send mail for " + run.id(), e); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index 210b94737b0..19d2ff5a544 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -236,7 +236,7 @@ public class ControllerTest { ZoneId zone = ZoneId.from(Environment.defaultEnvironment(), RegionName.defaultName()); ApplicationId app = ApplicationId.from("tenant", "app1", "default"); DeploymentId deployment = new DeploymentId(app, zone); - tester.routingGenerator().putEndpoints(deployment, List.of( + tester.serviceRegistry().routingGeneratorMock().putEndpoints(deployment, List.of( new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream2"), new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream3"), @@ -265,7 +265,7 @@ public class ControllerTest { assertEquals("unit-test", findStatusByUpstream.apply("upstream1").get().getReason()); // Deployment without a global endpoint - tester.routingGenerator().putEndpoints(deployment, List.of( + tester.serviceRegistry().routingGeneratorMock().putEndpoints(deployment, List.of( new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream2"), new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream3") diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java index 0cabd2ce63c..19a152a5ba0 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java @@ -27,9 +27,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName; import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact; import com.yahoo.vespa.hosted.controller.api.integration.organization.MockContactRetriever; -import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService; -import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMavenRepository; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMeteringClient; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockRunDataStore; @@ -38,12 +36,10 @@ import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.athenz.impl.AthenzFacade; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock; -import com.yahoo.vespa.hosted.controller.integration.ApplicationCertificateMock; import com.yahoo.vespa.hosted.controller.integration.ApplicationStoreMock; import com.yahoo.vespa.hosted.controller.integration.ArtifactRepositoryMock; import com.yahoo.vespa.hosted.controller.integration.ConfigServerMock; import com.yahoo.vespa.hosted.controller.integration.MetricsServiceMock; -import com.yahoo.vespa.hosted.controller.integration.RoutingGeneratorMock; import com.yahoo.vespa.hosted.controller.integration.ServiceRegistryMock; import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock; import com.yahoo.vespa.hosted.controller.persistence.ApplicationSerializer; @@ -87,17 +83,22 @@ public final class ControllerTester { private final ApplicationStoreMock applicationStore; private final MockBuildService buildService; private final MetricsServiceMock metricsService; - private final RoutingGeneratorMock routingGenerator; private final MockContactRetriever contactRetriever; private Controller controller; public ControllerTester(ManualClock clock, RotationsConfig rotationsConfig, MockCuratorDb curatorDb, MetricsServiceMock metricsService) { - this(new AthenzDbMock(), clock, - new ZoneRegistryMock(), curatorDb, rotationsConfig, - new ArtifactRepositoryMock(), new ApplicationStoreMock(), new MockBuildService(), - metricsService, new RoutingGeneratorMock(), new MockContactRetriever(), + this(new AthenzDbMock(), + clock, + new ZoneRegistryMock(), + curatorDb, + rotationsConfig, + new ArtifactRepositoryMock(), + new ApplicationStoreMock(), + new MockBuildService(), + metricsService, + new MockContactRetriever(), new ServiceRegistryMock()); } @@ -122,7 +123,7 @@ public final class ControllerTester { CuratorDb curator, RotationsConfig rotationsConfig, ArtifactRepositoryMock artifactRepository, ApplicationStoreMock appStoreMock, MockBuildService buildService, - MetricsServiceMock metricsService, RoutingGeneratorMock routingGenerator, + MetricsServiceMock metricsService, MockContactRetriever contactRetriever, ServiceRegistryMock serviceRegistry) { this.athenzDb = athenzDb; @@ -135,11 +136,10 @@ public final class ControllerTester { this.applicationStore = appStoreMock; this.buildService = buildService; this.metricsService = metricsService; - this.routingGenerator = routingGenerator; this.contactRetriever = contactRetriever; this.controller = createController(curator, rotationsConfig, clock, zoneRegistry, athenzDb, artifactRepository, appStoreMock, buildService, - metricsService, routingGenerator, serviceRegistry); + metricsService, serviceRegistry); // Make root logger use time from manual clock configureDefaultLogHandler(handler -> handler.setFilter( @@ -185,8 +185,6 @@ public final class ControllerTester { public MetricsServiceMock metricsService() { return metricsService; } - public RoutingGeneratorMock routingGenerator() { return routingGenerator; } - public MockContactRetriever contactRetriever() { return contactRetriever; } @@ -199,7 +197,7 @@ public final class ControllerTester { public final void createNewController() { controller = createController(curator, rotationsConfig, clock, zoneRegistry, athenzDb, artifactRepository, applicationStore, buildService, metricsService, - routingGenerator, serviceRegistry); + serviceRegistry); } /** Creates the given tenant and application and deploys it */ @@ -333,13 +331,11 @@ public final class ControllerTester { AthenzDbMock athensDb, ArtifactRepository artifactRepository, ApplicationStore applicationStore, BuildService buildService, MetricsServiceMock metricsService, - RoutingGenerator routingGenerator, ServiceRegistryMock serviceRegistry) { Controller controller = new Controller(curator, rotationsConfig, zoneRegistryMock, metricsService, - routingGenerator, clock, new AthenzFacade(new AthenzClientFactoryMock(athensDb)), artifactRepository, @@ -348,10 +344,8 @@ public final class ControllerTester { buildService, new MockRunDataStore(), () -> "test-controller", - new MockMailer(), new InMemoryFlagSource(), new MockMavenRepository(), - new ApplicationCertificateMock(), new MockMeteringClient(), serviceRegistry); // Calculate initial versions diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java index 46e991a135a..fdb797a6bcd 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java @@ -78,7 +78,7 @@ public class InternalDeploymentTester { "default", 1); jobs = tester.controller().jobController(); - routing = tester.controllerTester().routingGenerator(); + routing = tester.controllerTester().serviceRegistry().routingGeneratorMock(); cloud = (MockTesterCloud) tester.controller().jobController().cloud(); runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), JobRunnerTest.inThreadExecutor(), new InternalStepRunner(tester.controller())); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java index f5366ae3862..1ae00231364 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java @@ -351,7 +351,7 @@ public class InternalStepRunnerTest { tester.startSystemTestTests(); tester.cloud().set(TesterCloud.Status.NOT_STARTED); tester.runner().run(); - MockMailer mailer = ((MockMailer) tester.tester().controller().mailer()); + MockMailer mailer = ((MockMailer) tester.tester().controller().serviceRegistry().mailer()); assertEquals(1, mailer.inbox("a@b").size()); assertEquals("Vespa application tenant.application: System test failing due to system error", mailer.inbox("a@b").get(0).subject()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java index f41d7760698..19b359c3851 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java @@ -3,11 +3,15 @@ package com.yahoo.vespa.hosted.controller.integration; import com.yahoo.component.AbstractComponent; import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry; +import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.dns.MemoryNameService; import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService; +import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer; import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; import com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRoutingService; +import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; +import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer; /** * A mock implementation of a {@link ServiceRegistry} for testing purposes. @@ -20,6 +24,9 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg private final ConfigServerMock configServerMock = new ConfigServerMock(zoneRegistryMock); private final MemoryNameService memoryNameService = new MemoryNameService(); private final MemoryGlobalRoutingService memoryGlobalRoutingService = new MemoryGlobalRoutingService(); + private final RoutingGeneratorMock routingGeneratorMock = new RoutingGeneratorMock(); + private final MockMailer mockMailer = new MockMailer(); + private final ApplicationCertificateMock applicationCertificateMock = new ApplicationCertificateMock(); @Override public ConfigServer configServer() { @@ -32,6 +39,21 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg } @Override + public RoutingGenerator routingGenerator() { + return routingGeneratorMock; + } + + @Override + public Mailer mailer() { + return mockMailer; + } + + @Override + public ApplicationCertificateProvider applicationCertificateProvider() { + return applicationCertificateMock; + } + + @Override public NameService nameService() { return memoryNameService; } @@ -51,4 +73,9 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg public MemoryGlobalRoutingService globalRoutingServiceMock() { return memoryGlobalRoutingService; } + + public RoutingGeneratorMock routingGeneratorMock() { + return routingGeneratorMock; + } + } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java index 9be4eb5f5b4..0dee5fcb78c 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java @@ -228,7 +228,7 @@ public class RoutingPoliciesTest { public void cluster_endpoints_resolve_from_policies() { provisionLoadBalancers(3, app1.id(), zone1); tester.deployCompletely(app1, applicationPackage); - tester.controllerTester().routingGenerator().putEndpoints(new DeploymentId(app1.id(), zone1), Collections.emptyList()); + tester.controllerTester().serviceRegistry().routingGeneratorMock().putEndpoints(new DeploymentId(app1.id(), zone1), Collections.emptyList()); assertEquals(Map.of(ClusterSpec.Id.from("c0"), URI.create("https://c0.app1.tenant1.us-west-1.vespa.oath.cloud/"), ClusterSpec.Id.from("c1"), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java index d697e9051b8..6411fbe5cbf 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java @@ -86,12 +86,9 @@ public class ControllerContainerTest { " </config>" + " </component>" + " <component id='com.yahoo.vespa.hosted.controller.maintenance.JobControl'/>\n" + - " <component id='com.yahoo.vespa.hosted.controller.integration.RoutingGeneratorMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.integration.ArtifactRepositoryMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.integration.ApplicationStoreMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.MockTesterCloud'/>\n" + - " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer'/>\n" + - " <component id='com.yahoo.vespa.hosted.controller.integration.ApplicationCertificateMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMavenRepository'/>\n" + " <handler id='com.yahoo.vespa.hosted.controller.restapi.deployment.DeploymentApiHandler'>\n" + " <binding>http://*/deployment/v1/*</binding>\n" + |