summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2022-01-05 15:23:51 +0100
committerGitHub <noreply@github.com>2022-01-05 15:23:51 +0100
commit2dce356cfd19eceed2cd77718a9db43634e7371b (patch)
treeb602ca0bd671dbe6ad8a1321bfa09f52dab94a7c
parentd81121c2aa0dfb1874d8ba326d53a2a4b30bd146 (diff)
parent3c5a7dc42df3b813042f8ebc28fca252cb3a8d12 (diff)
Merge pull request #20662 from vespa-engine/mpolden/fix-exception-type
Let repeated deployments surface as bad request
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java2
2 files changed, 2 insertions, 3 deletions
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 fe4b3956f9b..6e5218917bf 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
@@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.deployment;
import com.google.common.collect.ImmutableSortedMap;
import com.yahoo.component.Version;
-import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.curator.Lock;
@@ -482,7 +481,7 @@ public class JobController {
locked(id, type, __ -> {
Optional<Run> last = last(id, type);
if (last.flatMap(run -> active(run.id())).isPresent())
- throw new IllegalStateException("Can not start " + type + " for " + id + "; it is already running!");
+ throw new IllegalArgumentException("Cannot start " + type + " for " + id + "; it is already running!");
RunId newId = new RunId(id, type, last.map(run -> run.id().number()).orElse(0L) + 1);
curator.writeLastRun(Run.initial(newId, versions, isRedeployment, controller.clock().instant(), profile));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java
index 7db52b6121b..2bf941a3145 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java
@@ -98,7 +98,7 @@ public class JobRunnerTest {
jobs.start(id, systemTest, versions);
fail("Job is already running, so this should not be allowed!");
}
- catch (IllegalStateException ignored) { }
+ catch (IllegalArgumentException ignored) { }
jobs.start(id, stagingTest, versions);
assertTrue(jobs.last(id, systemTest).get().stepStatuses().values().stream().allMatch(unfinished::equals));