diff options
6 files changed, 83 insertions, 14 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java index 0a7bacefffb..a4093bc80af 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java @@ -1,19 +1,29 @@ package com.yahoo.vespa.hosted.controller.api.integration; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; -// TODO jvenstad: Change most of this. public interface LogStore { - /** Returns the log of the given deployment job. */ - String getTestLog(ApplicationId application, JobType jobType, int build); + /** @return the test log of the given deployment job. */ + String getTestLog(ApplicationId applicationId, JobType jobType, long buildId); - /** Stores the given log for the given deployment job. */ - void setTestLog(ApplicationId application, JobType jobType, int build, String log); + /** Stores the given test log for the given deployment job. */ + void setTestLog(ApplicationId applicationId, JobType jobType, long buildId, String testLog); - /** Deletes the log for the given deployment job. */ - void deleteTestLog(ApplicationId application, JobType jobType, int build); + /** @return the convergence log of the given deployment job. */ + String getConvergenceLog(ApplicationId applicationId, JobType jobType, long buildId); + /** Stores the given convergence log for the given deployment job. */ + void setConvergenceLog(ApplicationId applicationId, JobType jobType, long buildId, String convergenceLog); + + /** @return the result of prepare of the test application for the given deployment job. */ + PrepareResponse getPrepareResponse(ApplicationId applicationId, JobType jobType, long buildId); + + /** Stores the given result of prepare of the test application for the given deployment job. */ + void setPrepareResponse(ApplicationId applicationId, JobType jobType, long buildId, PrepareResponse prepareResponse); + + /** Deletes all data associated with test of a given deployment job */ + void deleteTestData(ApplicationId applicationId, JobType jobType, long buildId); } 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 3f5f3369c0a..c90ab5d19ba 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 @@ -12,6 +12,7 @@ import com.yahoo.vespa.curator.Lock; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; +import com.yahoo.vespa.hosted.controller.api.integration.LogStore; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory; import com.yahoo.vespa.hosted.controller.api.integration.chef.Chef; @@ -88,12 +89,12 @@ public class Controller extends AbstractComponent { ZoneRegistry zoneRegistry, ConfigServer configServer, MetricsService metricsService, NameService nameService, RoutingGenerator routingGenerator, Chef chef, AthenzClientFactory athenzClientFactory, - ArtifactRepository artifactRepository, BuildService buildService) { + ArtifactRepository artifactRepository, BuildService buildService, LogStore logStore) { this(curator, rotationsConfig, gitHub, entityService, organization, globalRoutingService, zoneRegistry, configServer, metricsService, nameService, routingGenerator, chef, Clock.systemUTC(), athenzClientFactory, artifactRepository, buildService, - com.yahoo.net.HostName::getLocalhost); + logStore, com.yahoo.net.HostName::getLocalhost); } public Controller(CuratorDb curator, RotationsConfig rotationsConfig, @@ -103,7 +104,7 @@ public class Controller extends AbstractComponent { MetricsService metricsService, NameService nameService, RoutingGenerator routingGenerator, Chef chef, Clock clock, AthenzClientFactory athenzClientFactory, ArtifactRepository artifactRepository, - BuildService buildService, Supplier<String> hostnameSupplier) { + BuildService buildService, LogStore logStore, Supplier<String> hostnameSupplier) { this.hostnameSupplier = Objects.requireNonNull(hostnameSupplier, "HostnameSupplier cannot be null"); this.curator = Objects.requireNonNull(curator, "Curator cannot be null"); @@ -118,7 +119,7 @@ public class Controller extends AbstractComponent { this.clock = Objects.requireNonNull(clock, "Clock cannot be null"); this.athenzClientFactory = Objects.requireNonNull(athenzClientFactory, "AthenzClientFactory cannot be null"); - jobController = new JobController(this); + jobController = new JobController(this, logStore); applicationController = new ApplicationController(this, curator, athenzClientFactory, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"), Objects.requireNonNull(nameService, "NameService cannot be null"), diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java index 2d1040f7095..4da13632eef 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java @@ -22,9 +22,9 @@ public class JobController { private final Controller controller; private final LogStore logs; - public JobController(Controller controller) { + public JobController(Controller controller, LogStore logStore) { this.controller = controller; - this.logs = null; + this.logs = logStore; } 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 d3b70ea07d8..24ba337f1ea 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 @@ -28,6 +28,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; 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.MockLogStore; import com.yahoo.vespa.hosted.controller.integration.MockMetricsService; import com.yahoo.vespa.hosted.controller.persistence.ApplicationSerializer; import com.yahoo.vespa.hosted.controller.persistence.CuratorDb; @@ -280,6 +281,7 @@ public final class ControllerTester { new AthenzClientFactoryMock(athensDb), artifactRepository, buildService, + new MockLogStore(), () -> "test-controller"); controller.updateVersionStatus(VersionStatus.compute(controller)); return controller; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockLogStore.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockLogStore.java new file mode 100644 index 00000000000..863b3cecfff --- /dev/null +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockLogStore.java @@ -0,0 +1,55 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.integration; + +import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions; +import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId; +import com.yahoo.vespa.hosted.controller.api.integration.LogStore; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; + +import java.util.Collections; + +/** + * @author freva + */ +public class MockLogStore implements LogStore { + @Override + public String getTestLog(ApplicationId applicationId, JobType jobType, long buildId) { + return "SUCCESS"; + } + + @Override + public void setTestLog(ApplicationId applicationId, JobType jobType, long buildId, String testLog) { + + } + + @Override + public String getConvergenceLog(ApplicationId applicationId, JobType jobType, long buildId) { + return "SUCCESS"; + } + + @Override + public void setConvergenceLog(ApplicationId applicationId, JobType jobType, long buildId, String convergenceLog) { + + } + + @Override + public PrepareResponse getPrepareResponse(ApplicationId applicationId, JobType jobType, long buildId) { + PrepareResponse prepareResponse = new PrepareResponse(); + prepareResponse.message = "foo"; + prepareResponse.configChangeActions = new ConfigChangeActions(Collections.emptyList(), + Collections.emptyList()); + prepareResponse.tenant = new TenantId("tenant"); + return prepareResponse; } + + @Override + public void setPrepareResponse(ApplicationId applicationId, JobType jobType, long buildId, PrepareResponse prepareResponse) { + + } + + @Override + public void deleteTestData(ApplicationId applicationId, JobType jobType, long buildId) { + + } +} 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 833e2d8b552..4a194f376a4 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 @@ -76,6 +76,7 @@ public class ControllerContainerTest { " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.ConfigServerProxyMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.integration.MockMetricsService'/>\n" + + " <component id='com.yahoo.vespa.hosted.controller.integration.MockLogStore'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.maintenance.ControllerMaintenance'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.maintenance.JobControl'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.routing.MockRoutingGenerator'/>\n" + |