aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java16
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json29
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance.json82
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json82
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/jobs.json22
5 files changed, 157 insertions, 74 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index 45d87c6756a..810b9c2550c 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -257,8 +257,22 @@ public class ApplicationApiTest extends ControllerContainerTest {
ApplicationId id = ApplicationId.from("tenant1", "application1", "instance1");
var app1 = deploymentTester.newDeploymentContext(id);
- // POST (deploy) an application to start a manual deployment to dev
+ // POST (deploy) an application to start a manual deployment in prod is not allowed
MultiPartStreamer entity = createApplicationDeployData(applicationPackageInstance1, true);
+ tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/deploy/production-us-east-3/", POST)
+ .data(entity)
+ .userIdentity(USER_ID),
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Direct deployments are only allowed to manually deployed environments.\"}", 400);
+
+ // POST (deploy) an application to start a manual deployment in prod is allowed for operators
+ tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/deploy/production-us-east-3/", POST)
+ .data(entity)
+ .userIdentity(HOSTED_VESPA_OPERATOR),
+ "{\"message\":\"Deployment started in run 1 of production-us-east-3 for tenant1.application1.instance1. This may take about 15 minutes the first time.\",\"run\":1}");
+ app1.runJob(JobType.productionUsEast3);
+ tester.controller().applications().deactivate(app1.instanceId(), ZoneId.from("prod", "us-east-3"));
+
+ // POST (deploy) an application to start a manual deployment to dev
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/deploy/dev-us-east-1/", POST)
.data(entity)
.userIdentity(USER_ID),
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 282c18046d3..fe9d0573ed2 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
@@ -464,8 +464,8 @@
],
"runs": [
{
- "id": 1,
- "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3/run/1",
+ "id": 2,
+ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3/run/2",
"start": "(ignore)",
"status": "aborted",
"versions": {
@@ -491,6 +491,31 @@
"status": "unfinished"
}
]
+ },
+ {
+ "id": 1,
+ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3/run/1",
+ "start": "(ignore)",
+ "end": "(ignore)",
+ "status": "success",
+ "versions": {
+ "targetPlatform": "6.1.0",
+ "targetApplication": {}
+ },
+ "steps": [
+ {
+ "name": "deployReal",
+ "status": "succeeded"
+ },
+ {
+ "name": "installReal",
+ "status": "succeeded"
+ },
+ {
+ "name": "copyVespaLogs",
+ "status": "succeeded"
+ }
+ ]
}
]
},
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance.json
index fd8bc256ac5..3d1c5ade300 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance.json
@@ -13,8 +13,8 @@
"projectId": 123,
"deploying": {
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -30,10 +30,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -47,10 +47,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -64,10 +64,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -85,10 +85,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -102,10 +102,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -119,10 +119,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -140,10 +140,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -157,10 +157,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -174,10 +174,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -192,13 +192,13 @@
},
{
"type": "production-us-east-3",
- "success": false,
+ "success": true,
"lastTriggered": {
- "id": 1,
- "version": "(ignore)",
+ "id": 2,
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -209,6 +209,18 @@
},
"reason": "unknown reason",
"at": "(ignore)"
+ },
+ "lastCompleted": {
+ "id": 1,
+ "version": "6.1.0",
+ "reason": "unknown reason",
+ "at": "(ignore)"
+ },
+ "lastSuccess": {
+ "id": 1,
+ "version": "6.1.0",
+ "reason": "unknown reason",
+ "at": "(ignore)"
}
},
{
@@ -263,7 +275,7 @@
"rotationId": "rotation-id-1",
"clusterId": "foo",
"status": "IN",
- "lastUpdated":"(ignore)"
+ "lastUpdated": "(ignore)"
}
],
"environment": "prod",
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
index ee75d129241..1b7e7893222 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
@@ -13,8 +13,8 @@
"projectId": 123,
"deploying": {
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -30,10 +30,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -47,10 +47,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -64,10 +64,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -85,10 +85,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -102,10 +102,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -119,10 +119,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -140,10 +140,10 @@
"success": true,
"lastTriggered": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -157,10 +157,10 @@
},
"lastCompleted": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -174,10 +174,10 @@
},
"lastSuccess": {
"id": 1,
- "version": "(ignore)",
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -192,13 +192,13 @@
},
{
"type": "production-us-east-3",
- "success": false,
+ "success": true,
"lastTriggered": {
- "id": 1,
- "version": "(ignore)",
+ "id": 2,
+ "version": "6.1.0",
"revision": {
- "buildNumber": "(ignore)",
- "hash": "(ignore)",
+ "buildNumber": 1,
+ "hash": "1.0.1-commit1",
"source": {
"gitRepository": "repository1",
"gitBranch": "master",
@@ -209,6 +209,18 @@
},
"reason": "unknown reason",
"at": "(ignore)"
+ },
+ "lastCompleted": {
+ "id": 1,
+ "version": "6.1.0",
+ "reason": "unknown reason",
+ "at": "(ignore)"
+ },
+ "lastSuccess": {
+ "id": 1,
+ "version": "6.1.0",
+ "reason": "unknown reason",
+ "at": "(ignore)"
}
},
{
@@ -241,7 +253,7 @@
]
}
],
- "compileVersion": "(ignore)",
+ "compileVersion": "6.0.0",
"globalRotations": [
"https://instance1--application1--tenant1.global.vespa.oath.cloud:4443/"
],
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/jobs.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/jobs.json
index 8cd102432d0..b16ca4cc67c 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/jobs.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/jobs.json
@@ -275,7 +275,7 @@
"us-east-3": {
"runs": [
{
- "id": 1,
+ "id": 2,
"status": "aborted",
"start": "(ignore)",
"wantedPlatform": "6.1",
@@ -296,6 +296,26 @@
"report": "unfinished"
},
"tasks": {},
+ "log": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3/run/2"
+ },
+ {
+ "id": 1,
+ "status": "success",
+ "start": "(ignore)",
+ "end": "(ignore)",
+ "wantedPlatform": "6.1",
+ "wantedApplication": {
+ "hash": "unknown"
+ },
+ "steps": {
+ "deployReal": "succeeded",
+ "installReal": "succeeded",
+ "copyVespaLogs": "succeeded"
+ },
+ "tasks": {
+ "deploy": "succeeded",
+ "install": "succeeded"
+ },
"log": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/production-us-east-3/run/1"
}
],