summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-01-05 14:36:32 +0100
committerMartin Polden <mpolden@mpolden.no>2022-01-05 15:10:51 +0100
commit3c5a7dc42df3b813042f8ebc28fca252cb3a8d12 (patch)
treec113f5a1c35b6e893729bb6268fcc106960527f6
parentcfaa0be19da00466a73b57a9630477eabe46a8bd (diff)
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));