summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorValerij Fredriksen <valerij92@gmail.com>2021-07-05 15:00:25 +0200
committerValerij Fredriksen <valerij92@gmail.com>2021-07-05 15:00:25 +0200
commitbd2e2941a905d155f19c44d3f40be15022c6a4b2 (patch)
treefa03c925e9f2e9c2ed956a6dd3e6bfd5993e0a45 /controller-server
parent04e79b0c11e4328806352f5a547bb9db1a95dddf (diff)
Reverse run order
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-job.json58
2 files changed, 34 insertions, 30 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
index 46ba91b45a5..eb9b0e03f3d 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
@@ -40,10 +40,12 @@ import java.time.Instant;
import java.time.format.TextStyle;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy.canary;
@@ -126,7 +128,9 @@ class JobControllerApiHandlerHelper {
runs.forEach((runid, run) -> runToSlime(cursor.setObject(Long.toString(runid.number())), run, baseUriForJobType));
else {
int limit = limitStr.map(Integer::parseInt).orElse(Integer.MAX_VALUE);
- toSlime(cursor.setArray("runs"), runs.values(), limit, baseUriForJobType);
+ toSlime(cursor.setArray("runs"), runs.values().stream()
+ .sorted(Comparator.comparing((Run run) -> run.id().number()).reversed())
+ .collect(Collectors.toUnmodifiableList()), limit, baseUriForJobType);
}
return new SlimeJsonResponse(slime);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-job.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-job.json
index 2f99fce28c8..c0988e8c301 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-job.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-job.json
@@ -1,15 +1,14 @@
{
"runs": [
{
- "id": 1,
- "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/1",
+ "id": 2,
+ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/2",
"start": "(ignore)",
- "end": "(ignore)",
- "status": "success",
+ "status": "running",
"versions": {
"targetPlatform": "6.1.0",
"targetApplication": {
- "build": 1,
+ "build": 4,
"compileVersion": "6.1.0",
"sourceUrl": "repository1/tree/commit1",
"commit": "commit1"
@@ -18,55 +17,56 @@
"steps": [
{
"name": "deployTester",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "installTester",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "deployReal",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "installReal",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "startTests",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "endTests",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "copyVespaLogs",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "deactivateReal",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "deactivateTester",
- "status": "succeeded"
+ "status": "unfinished"
},
{
"name": "report",
- "status": "succeeded"
+ "status": "unfinished"
}
]
},
{
- "id": 2,
- "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/2",
+ "id": 1,
+ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/1",
"start": "(ignore)",
- "status": "running",
+ "end": "(ignore)",
+ "status": "success",
"versions": {
"targetPlatform": "6.1.0",
"targetApplication": {
- "build": 4,
+ "build": 1,
"compileVersion": "6.1.0",
"sourceUrl": "repository1/tree/commit1",
"commit": "commit1"
@@ -75,43 +75,43 @@
"steps": [
{
"name": "deployTester",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "installTester",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "deployReal",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "installReal",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "startTests",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "endTests",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "copyVespaLogs",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "deactivateReal",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "deactivateTester",
- "status": "unfinished"
+ "status": "succeeded"
},
{
"name": "report",
- "status": "unfinished"
+ "status": "succeeded"
}
]
}