summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-04-30 13:53:17 +0200
committerJon Marius Venstad <venstad@gmail.com>2020-04-30 13:53:17 +0200
commit6633988c2466a030d9751de49bb58c4a0a2e82b3 (patch)
tree2bbda86c4745b948c0ab77274f158abc7243aa26
parent76604e83fba9b60cb44b9be31eb659c09a1cc0ea (diff)
Consistently choose instance for implicit tests to avoid duplicates
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
index 0419b4038bc..da1bcbdab54 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
@@ -34,6 +34,7 @@ import static com.yahoo.config.provision.Environment.staging;
import static com.yahoo.config.provision.Environment.test;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static java.util.Comparator.comparing;
import static java.util.Comparator.naturalOrder;
import static java.util.Objects.requireNonNull;
import static java.util.function.BinaryOperator.maxBy;
@@ -234,17 +235,16 @@ public class DeploymentStatus {
&& testJobs.keySet().stream()
.noneMatch(test -> test.type() == testType
&& testJobs.get(test).contains(versions)))
- testJobs.merge(anyDeclaredTest(testType).orElse(new JobId(job.application(), testType)), List.of(versions), DeploymentStatus::union);
+ testJobs.merge(firstDeclaredOrElseImplicitTest(testType), List.of(versions), DeploymentStatus::union);
});
}
return ImmutableMap.copyOf(testJobs);
}
- private Optional<JobId> anyDeclaredTest(JobType testJob) {
+ private JobId firstDeclaredOrElseImplicitTest(JobType testJob) {
return application.deploymentSpec().instanceNames().stream()
- .map(application.id()::instance)
- .flatMap(id -> declaredTest(id, testJob).stream())
- .findFirst();
+ .map(name -> new JobId(application.id().instance(name), testJob))
+ .min(comparing(id -> !jobSteps.get(id).isDeclared())).orElseThrow();
}
/** JobId of any declared test of the given type, for the given instance. */