summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2020-02-17 14:54:25 +0100
committerGitHub <noreply@github.com>2020-02-17 14:54:25 +0100
commit0869beb224e3c2c6b0512faf4fd79ecef82bd476 (patch)
treeacab44e60d30849a109d51b4972f988dc0e8085c /controller-server
parentf5896686cd9eef35423defee1c8c6354bcf6c02f (diff)
parentdb7b9a005d19e7876295995bfa4e3d11929205ea (diff)
Merge pull request #12221 from vespa-engine/jvenstad/fix-prod-test-completion-criterion
Production tests must start after a successful deployment
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java9
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatusList.java10
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobList.java33
3 files changed, 17 insertions, 35 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..525eadb6eaf 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
@@ -117,7 +117,7 @@ public class JobList extends AbstractFilteringList<JobStatus, JobList> {
return new RunFilter(JobStatus::firstFailing);
}
- /** Allows sub-filters for runs of the given kind */
+ /** Allows sub-filters for runs of the indicated kind */
public class RunFilter {
private final Function<JobStatus, Optional<Run>> which;
@@ -126,47 +126,32 @@ public class JobList extends AbstractFilteringList<JobStatus, JobList> {
this.which = which;
}
- /** Returns the subset of jobs where the run of the given type exists */
+ /** Returns the subset of jobs where the run of the indicated type exists */
public JobList present() {
return matching(run -> true);
}
- /** Returns the runs of the given kind, mapped by the given function, as a list. */
+ /** Returns the runs of the indicated kind, mapped by the given function, as a list. */
public <OtherType> List<OtherType> mapToList(Function<? super Run, OtherType> mapper) {
return present().mapToList(which.andThen(Optional::get).andThen(mapper));
}
- /** Returns the runs of the given kind. */
+ /** Returns the runs of the indicated kind. */
public List<Run> asList() {
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 indicated type ended no later than 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 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 was on the given version */
+ /** Returns the subset of jobs where the run of the indicated type was on the given version */
public JobList on(ApplicationVersion version) {
return matching(run -> run.versions().targetApplication().equals(version));
}
- /** Returns the subset of jobs where the run of the given type was on the given version */
+ /** Returns the subset of jobs where the run of the indicated type was on the given version */
public JobList on(Version version) {
return matching(run -> run.versions().targetPlatform().equals(version));
}