diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-12-17 12:47:38 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-12-17 12:47:38 +0100 |
commit | ef4cfc33fdcb9c2f6d292de1a47b8e358016a424 (patch) | |
tree | dd42536eabb45d7503582c1bc0f7bceb2a069769 /controller-server | |
parent | 00c6de316f8682a3db04be7780fb7fddd3d8783b (diff) |
Hide irrelevant test jobs from deployment API payload
Diffstat (limited to 'controller-server')
2 files changed, 13 insertions, 33 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 b4904ca3cf8..0c4a666ce59 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 @@ -194,8 +194,14 @@ public class DeploymentStatus { return instances.build(); } - /** The step status for all steps in the deployment spec of this, in the same order as in the deployment spec. */ - public List<StepStatus> allSteps() { return allSteps; } + /** The step status for all relevant steps in the deployment spec of this, in the same order as in the deployment spec. */ + public List<StepStatus> allSteps() { + List<JobId> firstTestJobs = List.of(firstDeclaredOrElseImplicitTest(systemTest), + firstDeclaredOrElseImplicitTest(stagingTest)); + return allSteps.stream() + .filter(step -> step.isDeclared() || firstTestJobs.contains(step.job().orElseThrow())) + .collect(toUnmodifiableList()); + } public Optional<Deployment> deploymentFor(JobId job) { return Optional.ofNullable(application.require(job.application().instance()) @@ -273,7 +279,6 @@ public class DeploymentStatus { && testJobs.get(test).contains(versions))) testJobs.merge(firstDeclaredOrElseImplicitTest(testType), List.of(versions), DeploymentStatus::union); }); - // Add runs for declared tests in instances without production jobs, if no successes exist for given change. } return ImmutableMap.copyOf(testJobs); } @@ -281,7 +286,7 @@ public class DeploymentStatus { private JobId firstDeclaredOrElseImplicitTest(JobType testJob) { return application.deploymentSpec().instanceNames().stream() .map(name -> new JobId(application.id().instance(name), testJob)) - .min(comparing(id -> !jobSteps.get(id).isDeclared())).orElseThrow(); + .min(comparing(id -> ! jobSteps.get(id).isDeclared())).orElseThrow(); } /** JobId of any declared test of the given type, for the given instance. */ @@ -381,7 +386,7 @@ public class DeploymentStatus { public enum StepType { - /** An instance — completion marks a change as ready for the jobs contained in it. */ + /** An instance — completion marks a change as ready for the jobs contained in it. */ instance, /** A timed delay. */ diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json index 36aa8a87689..961d36bd2f3 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json @@ -550,32 +550,6 @@ } }, { - "type": "test", - "dependencies": [], - "declared": false, - "instance": "instance2", - "readyAt": 0, - "jobName": "system-test", - "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance2/job/system-test", - "environment": "test", - "region": "test.us-east-1", - "toRun": [], - "runs": [] - }, - { - "type": "test", - "dependencies": [], - "declared": false, - "instance": "instance2", - "readyAt": 0, - "jobName": "staging-test", - "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance2/job/staging-test", - "environment": "staging", - "region": "staging.us-east-3", - "toRun": [], - "runs": [] - }, - { "type": "deployment", "dependencies": [ 6 @@ -604,7 +578,7 @@ { "type": "deployment", "dependencies": [ - 9 + 7 ], "declared": true, "instance": "instance2", @@ -630,7 +604,7 @@ { "type": "deployment", "dependencies": [ - 9 + 7 ], "declared": true, "instance": "instance2", @@ -655,3 +629,4 @@ } ] } + |