diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-11-19 21:38:11 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-11-19 21:38:11 +0100 |
commit | 11e4907006c94bdd761e8f37bc9d006ae5b7bb40 (patch) | |
tree | 91c9d3dced99b50ef699a7881829f01a3776586e /configserver | |
parent | 2a00cc99b5a0cc92d286725af22fe46d0aa00142 (diff) |
Model disallowable actions separately, and collect and throw these in validation
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java | 7 | ||||
-rw-r--r-- | configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java | 23 |
2 files changed, 3 insertions, 27 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index b356b99c50a..b53447a1fd2 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -326,12 +326,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye long sessionId = createSession(applicationId, prepareParams.getTimeoutBudget(), applicationPackage); Deployment deployment = prepare(sessionId, prepareParams, logger); - if (deployment.configChangeActions().getRefeedActions().getEntries().stream().anyMatch(entry -> ! entry.allowed())) - logger.log(Level.WARNING, "Activation rejected because of disallowed re-feed actions"); - else if (deployment.configChangeActions().getReindexActions().getEntries().stream().anyMatch(entry -> ! entry.allowed())) - logger.log(Level.WARNING, "Activation rejected because of disallowed re-index actions"); - else - deployment.activate(); + deployment.activate(); return new PrepareResult(sessionId, deployment.configChangeActions(), logger); } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java index d7ff891d1d3..f7d1b37dcc5 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java @@ -27,6 +27,7 @@ import com.yahoo.vespa.config.server.http.InvalidApplicationException; import com.yahoo.vespa.config.server.http.v2.PrepareResult; import com.yahoo.vespa.config.server.model.TestModelFactory; import com.yahoo.vespa.config.server.session.PrepareParams; +import com.yahoo.vespa.config.server.session.Session; import com.yahoo.vespa.model.application.validation.change.VespaReindexAction; import com.yahoo.vespa.model.application.validation.change.VespaRestartAction; import org.junit.Rule; @@ -50,6 +51,7 @@ import static com.yahoo.vespa.config.server.deploy.DeployTester.createFailingMod import static com.yahoo.vespa.config.server.deploy.DeployTester.createHostedModelFactory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -391,27 +393,6 @@ public class HostedDeployTest { } @Test - public void testThatDisallowedConfigChangeActionsBlockDeployment() throws IOException { - List<Host> hosts = List.of(createHost("host1", "6.1.0"), - createHost("host2", "6.1.0"), - createHost("host3", "6.1.0"), - createHost("host4", "6.1.0")); - List<ServiceInfo> services = List.of( - new ServiceInfo("serviceName", "serviceType", null, Map.of("clustername", "cluster"), "configId", "hostName")); - - ManualClock clock = new ManualClock(Instant.EPOCH); - List<ModelFactory> modelFactories = List.of( - new ConfigChangeActionsModelFactory(Version.fromString("6.1.0"), - VespaReindexAction.of(ClusterSpec.Id.from("test"), ValidationId.indexModeChange, ValidationOverrides.empty, - "reindex please", services, "music", clock.instant()), - new VespaRestartAction(ClusterSpec.Id.from("test"), "change", services))); - - DeployTester tester = createTester(hosts, modelFactories, prodZone, clock); - PrepareResult prepareResult = tester.deployApp("src/test/apps/hosted/", "6.1.0"); - assertNull("Deployment was not activated", tester.applicationRepository().getActiveSession(tester.applicationId())); - } - - @Test public void testThatAllowedConfigChangeActionsAreActedUpon() throws IOException { List<Host> hosts = List.of(createHost("host1", "6.1.0"), createHost("host2", "6.1.0"), |