diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-11-06 09:28:29 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-11-06 12:08:46 +0100 |
commit | 91b08a230e74825d91604ecab82ccbf3ff6add86 (patch) | |
tree | af11a30d8a1242d28dc789dcf4039d0c7cad51ff | |
parent | b1fff6215065a467fbf761ae2412834a275df4f7 (diff) |
Really support multiple instances
8 files changed, 43 insertions, 23 deletions
diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java index f181b02a071..c52d432e73d 100644 --- a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java +++ b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java @@ -995,9 +995,9 @@ public class DeploymentSpecTest { " </prod>" + " <endpoints>" + " <endpoint id=\"foo\" container-id=\"bar\">" + - " <region>us-east</region>" + - " </endpoint>" + - " <endpoint id=\"nalle\" container-id=\"frosk\" />" + + " <region>us-east</region>" + + " </endpoint>" + + " <endpoint id=\"nalle\" container-id=\"frosk\" />" + " <endpoint container-id=\"quux\" />" + " </endpoints>" + " </instance>" + diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java index 73e3739a772..3f86d996ad7 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java @@ -78,7 +78,6 @@ public class DeploymentTrigger { */ public static final Duration maxPause = Duration.ofDays(3); - private final static Logger log = Logger.getLogger(DeploymentTrigger.class.getName()); private final Controller controller; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index 611e099e6aa..5cb7d7a6065 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -1934,8 +1934,6 @@ public class ApplicationApiHandler extends LoggingRequestHandler { ApplicationPackage applicationPackage = new ApplicationPackage(dataParts.get(EnvironmentResource.APPLICATION_ZIP)); if (DeploymentSpec.empty.equals(applicationPackage.deploymentSpec())) throw new IllegalArgumentException("Missing required file 'deployment.xml'"); - if (applicationPackage.deploymentSpec().instances().size() != 1) - throw new IllegalArgumentException("Only single-instance deployment specs are currently supported"); controller.applications().verifyApplicationIdentityConfiguration(TenantName.from(tenant), applicationPackage, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java index c352fc5550f..f91f35a6b1b 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java @@ -46,6 +46,8 @@ public class ApplicationPackageBuilder { private OptionalInt majorVersion = OptionalInt.empty(); private String instances = "default"; private String upgradePolicy = null; + private boolean explicitSystemTest = false; + private boolean explicitStagingTest = false; private Environment environment = Environment.prod; private String globalServiceId = null; private String athenzIdentityAttributes = null; @@ -61,6 +63,16 @@ public class ApplicationPackageBuilder { return this; } + public ApplicationPackageBuilder systemTest() { + this.explicitSystemTest = true; + return this; + } + + public ApplicationPackageBuilder stagingTest() { + this.explicitStagingTest = true; + return this; + } + public ApplicationPackageBuilder upgradePolicy(String upgradePolicy) { this.upgradePolicy = upgradePolicy; return this; @@ -177,6 +189,10 @@ public class ApplicationPackageBuilder { } xml.append(notifications); xml.append(blockChange); + if (explicitSystemTest) + xml.append(" <test />\n"); + if (explicitStagingTest) + xml.append(" <staging />\n"); xml.append(" <"); xml.append(environment.value()); if (globalServiceId != null) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java index 52db1061655..8fb766164c2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java @@ -862,7 +862,6 @@ public class DeploymentTriggerTest { } @Test - @Ignore public void testMultipleInstances() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .instances("instance1,instance2") @@ -870,7 +869,7 @@ public class DeploymentTriggerTest { .region("us-east-3") .build(); var app = tester.newDeploymentContext("tenant1", "application1", "instance1").submit(applicationPackage); // TODO jonmv: support instances in deployment context> - var otherInstance = tester.newDeploymentContext("tenant1", "application1", "instance2"); // TODO jonmv: support instances in deployment context> + var otherInstance = tester.newDeploymentContext("tenant1", "application1", "instance2"); app.runJob(systemTest).runJob(stagingTest).runJob(productionUsEast3); otherInstance.runJob(systemTest).runJob(stagingTest).runJob(productionUsEast3); assertEquals(2, app.application().instances().size()); 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 a1c9aa872fd..417842fb608 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 @@ -661,17 +661,21 @@ public class ApplicationApiTest extends ControllerContainerTest { .data(streamer), "{\"message\":\"Application package version: 1.0.3-commit1, source revision of repository 'repository1', branch 'master' with commit 'commit1', by a@b, built against 6.1 at 1970-01-01T00:00:01Z\"}"); - // Sixth attempt has a multi-instance deployment spec, and fails. + // Sixth attempt has a multi-instance deployment spec, and is accepted. ApplicationPackage multiInstanceSpec = new ApplicationPackageBuilder() .instances("instance1,instance2") + .systemTest() + .stagingTest() .environment(Environment.prod) .region("us-central-1") .parallel("us-west-1", "us-east-3") + .endpoint("default", "foo", "us-central-1", "us-west-1", "us-east-3") .build(); tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/submit", POST) .screwdriverIdentity(SCREWDRIVER_ID) .data(createApplicationSubmissionData(multiInstanceSpec, 123)), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Only single-instance deployment specs are currently supported\"}", 400); + "{\"message\":\"Application package version: 1.0.4-commit1, source revision of repository 'repository1', branch 'master' with commit 'commit1', by a@b, built against 6.1 at 1970-01-01T00:00:01Z\"}"); + // GET deployment job overview, after triggering system and staging test jobs. assertEquals(2, tester.controller().applications().deploymentTrigger().triggerReadyJobs()); @@ -730,6 +734,10 @@ public class ApplicationApiTest extends ControllerContainerTest { .userIdentity(USER_ID) .oktaAccessToken(OKTA_AT).oktaIdentityToken(OKTA_IT), "{\"message\":\"Deleted instance tenant1.application1.instance1\"}"); + tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance2", DELETE) + .userIdentity(USER_ID) + .oktaAccessToken(OKTA_AT).oktaIdentityToken(OKTA_IT), + "{\"message\":\"Deleted instance tenant1.application1.instance2\"}"); // DELETE a tenant tester.assertResponse(request("/application/v4/tenant/tenant1", DELETE).userIdentity(USER_ID) 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 8fe38db994d..b73c36c804b 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 @@ -3,12 +3,12 @@ "platform": { "platform": "6.1", "at": "(ignore)", - "pending": "Waiting for application change to 1.0.3-commit1 to complete" + "pending": "Waiting for application change to 1.0.4-commit1 to complete" }, "application": { "application": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", @@ -21,8 +21,8 @@ }, "deploying": { "application": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", @@ -43,8 +43,8 @@ "start": "(ignore)", "wantedPlatform": "6.1", "wantedApplication": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", @@ -111,8 +111,8 @@ "start": "(ignore)", "wantedPlatform": "6.1", "wantedApplication": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", @@ -181,8 +181,8 @@ "status": "pending", "wantedPlatform": "6.1", "wantedApplication": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", 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 df55185fde5..a572fa04781 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 @@ -39,8 +39,8 @@ "start": "(ignore)", "wantedPlatform": "6.1", "wantedApplication": { - "hash": "1.0.3-commit1", - "build": 3, + "hash": "1.0.4-commit1", + "build": 4, "source": { "gitRepository": "repository1", "gitBranch": "master", |