diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-02-17 14:13:56 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-02-17 14:13:56 +0100 |
commit | 197e45c615eb8dfe796f2e61d68019e69b8023fb (patch) | |
tree | 05791f87df148f036b42f0a2ff00ef6d695bb48b /controller-server | |
parent | b1c702d576acc700d2c47bd7dd84d222cd3b8e6e (diff) |
Production tests must start after a successful deployment
@mpolden please review and merge. This fixes an error where a production test would be marked as complete
as long as it was on the correct version, and _any_ production deployment had previously completed
Diffstat (limited to 'controller-server')
3 files changed, 11 insertions, 29 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 3a60c480100..6aebae66bad 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 @@ -17,7 +17,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.Deployment; -import com.yahoo.vespa.hosted.controller.versions.VersionStatus; import java.time.Duration; import java.time.Instant; @@ -579,8 +578,12 @@ public class DeploymentStatus { Versions versions = Versions.from(change, status.application, status.deploymentFor(job.id()), status.systemVersion); return job.lastSuccess() .filter(run -> versions.targetsMatch(run.versions())) - .filter(run -> status.instanceJobs(instance).get(prodType).lastCompleted() - .map(last -> ! last.end().get().isAfter(run.start())).orElse(false)) + .filter(run -> ! status.jobs() + .instance(instance) + .type(prodType) + .successOn(versions) + .lastCompleted().endedNoLaterThan(run.start()) + .isEmpty()) .map(run -> run.end().get()); } }; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatusList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatusList.java index c14493a0b72..efa21b71936 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatusList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatusList.java @@ -3,15 +3,9 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.collections.AbstractFilteringList; import com.yahoo.component.Version; -import com.yahoo.config.application.api.DeploymentSpec; -import com.yahoo.vespa.hosted.controller.Instance; -import com.yahoo.vespa.hosted.controller.application.ApplicationList; -import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; import java.time.Instant; import java.util.Collection; -import java.util.List; -import java.util.Optional; /** * List for filtering deployment status of applications, for inspection and decision making. @@ -48,14 +42,14 @@ public class DeploymentStatusList extends AbstractFilteringList<DeploymentStatus private static boolean failingUpgradeToVersionSince(JobList jobs, Version version, Instant threshold) { return ! jobs.not().failingApplicationChange() - .firstFailing().endedBefore(threshold) + .firstFailing().endedNoLaterThan(threshold) .lastCompleted().on(version) .isEmpty(); } private static boolean failingApplicationChangeSince(JobList jobs, Instant threshold) { return ! jobs.failingApplicationChange() - .firstFailing().endedBefore(threshold) + .firstFailing().endedNoLaterThan(threshold) .isEmpty(); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobList.java index f353910163f..f16f677709c 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobList.java @@ -141,24 +141,9 @@ public class JobList extends AbstractFilteringList<JobStatus, JobList> { return mapToList(Function.identity()); } - /** Returns the subset of jobs where the run of the given type occurred before the given instant */ - public JobList endedBefore(Instant threshold) { - return matching(run -> run.end().orElse(Instant.MAX).isBefore(threshold)); - } - - /** Returns the subset of jobs where the run of the given type occurred after the given instant */ - public JobList endedAfter(Instant threshold) { - return matching(run -> run.end().orElse(Instant.MIN).isAfter(threshold)); - } - - /** Returns the subset of jobs where the run of the given type occurred before the given instant */ - public JobList startedBefore(Instant threshold) { - return matching(run -> run.start().isBefore(threshold)); - } - - /** Returns the subset of jobs where the run of the given type occurred after the given instant */ - public JobList startedAfter(Instant threshold) { - return matching(run -> run.start().isAfter(threshold)); + /** Returns the subset of jobs where the run of the given type occurred at or before the given instant */ + public JobList endedNoLaterThan(Instant threshold) { + return matching(run -> ! run.end().orElse(Instant.MAX).isAfter(threshold)); } /** Returns the subset of jobs where the run of the given type was on the given version */ |