diff options
Diffstat (limited to 'controller-server/src/test/java/com/yahoo')
13 files changed, 171 insertions, 16 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java index 0c238ea7c9d..f39374a2a89 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java @@ -73,7 +73,7 @@ public class DeploymentExpirerTest { // Dev application expires when enough time has passed since most recent attempt // Redeployments done by DeploymentUpgrader do not affect this tester.clock().advance(Duration.ofDays(12).plus(Duration.ofSeconds(1))); - tester.jobs().start(devApp.instanceId(), DeploymentContext.devUsEast1, lastRun.versions(), true, Optional.of("upgrade")); + tester.jobs().start(devApp.instanceId(), DeploymentContext.devUsEast1, lastRun.versions(), true, Run.Reason.because("upgrade")); expirer.maintain(); assertEquals(0, permanentDeployments(devApp.instance())); assertEquals(1, permanentDeployments(prodApp.instance())); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java index b0fe2867ab7..3ee6c7aadc3 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java @@ -14,6 +14,7 @@ import com.yahoo.vespa.hosted.controller.deployment.JobController; import com.yahoo.vespa.hosted.controller.deployment.JobMetrics; import com.yahoo.vespa.hosted.controller.deployment.JobProfile; import com.yahoo.vespa.hosted.controller.deployment.Run; +import com.yahoo.vespa.hosted.controller.deployment.Run.Reason; import com.yahoo.vespa.hosted.controller.deployment.RunStatus; import com.yahoo.vespa.hosted.controller.deployment.Step; import com.yahoo.vespa.hosted.controller.deployment.Step.Status; @@ -423,7 +424,7 @@ public class JobRunnerTest { } private void start(JobController jobs, ApplicationId id, JobType type) { - jobs.start(id, type, versions, false, Optional.empty()); + jobs.start(id, type, versions, false, Reason.empty()); } public static ExecutorService inThreadExecutor() { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java index cae5037ab6f..fc1a694e0f7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java @@ -7,12 +7,15 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.CloudAccount; import com.yahoo.security.X509CertificateUtils; import com.yahoo.slime.SlimeUtils; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; +import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.deployment.ConvergenceSummary; import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext; import com.yahoo.vespa.hosted.controller.deployment.JobProfile; import com.yahoo.vespa.hosted.controller.deployment.Run; +import com.yahoo.vespa.hosted.controller.deployment.Run.Reason; import com.yahoo.vespa.hosted.controller.deployment.RunStatus; import com.yahoo.vespa.hosted.controller.deployment.Step; import com.yahoo.vespa.hosted.controller.deployment.StepInfo; @@ -82,11 +85,15 @@ public class RunSerializerTest { assertFalse(run.hasEnded()); assertEquals(running, run.status()); assertEquals(3, run.lastTestLogEntry()); - assertEquals(new Version(1, 2, 3), run.versions().targetPlatform()); + Version version1 = new Version(1, 2, 3); + assertEquals(version1, run.versions().targetPlatform()); RevisionId revision1 = RevisionId.forDevelopment(123, id.job()); RevisionId revision2 = RevisionId.forProduction(122); assertEquals(revision1, run.versions().targetRevision()); - assertEquals("because", run.reason().get()); + assertEquals(new Reason(Optional.of("because"), + Optional.of(new JobId(id.application(), id.type())), + Optional.of(Change.of(version1).with(revision2))), + run.reason()); assertEquals(new Version(1, 2, 2), run.versions().sourcePlatform().get()); assertEquals(revision2, run.versions().sourceRevision().get()); assertEquals(Optional.of(new ConvergenceSummary(1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233)), @@ -145,7 +152,8 @@ public class RunSerializerTest { assertEquals(new String(SlimeUtils.toJsonBytes(serializer.toSlime(run).get(), false), UTF_8), new String(SlimeUtils.toJsonBytes(serializer.toSlime(phoenix).get(), false), UTF_8)); - Run initial = Run.initial(id, run.versions(), run.isRedeployment(), run.start(), JobProfile.production, Optional.empty()); + Run initial = Run.initial(id, run.versions(), run.isRedeployment(), run.start(), JobProfile.production, + new Reason(Optional.empty(), Optional.empty(), Optional.empty())); assertEquals(initial, serializer.runFromSlime(serializer.toSlime(initial))); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json index 1216bcefab6..618a7e66c5e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json @@ -54,6 +54,14 @@ "deployedDirectly": false } }, - "reason": "because" + "reason": "because", + "dependent": { + "id": "tenant:application:default", + "type": "prod.us-east-3" + }, + "change": { + "platform": "1.2.3", + "build": 122 + } } ]
\ No newline at end of file diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json index 19b3d5dc2d7..f49b7d9ccae 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json @@ -167,6 +167,11 @@ "start": 14403000, "end": 14403000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -225,6 +230,11 @@ "start": 1000, "end": 1000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 2 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -283,6 +293,11 @@ "start": 0, "end": 0, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -351,6 +366,11 @@ "environment": "staging", "toRun": [ { + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -376,6 +396,11 @@ "start": 14503000, "end": 14503000, "status": "installationFailed", + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -457,6 +482,11 @@ "start": 14403000, "end": 14403000, "status": "installationFailed", + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -538,6 +568,11 @@ "start": 14403000, "end": 14403000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -619,6 +654,11 @@ "start": 1000, "end": 1000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 2 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -700,6 +740,11 @@ "start": 0, "end": 0, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { 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 1d115049b35..617fb48a281 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 @@ -79,6 +79,11 @@ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/2", "start": 1600000000000, "status": "running", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 4 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -137,6 +142,11 @@ "start": 1600000000000, "end": 1600000000000, "status": "success", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -209,6 +219,11 @@ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/staging-test/run/2", "start": 1600000000000, "status": "running", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 4 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -283,6 +298,11 @@ "start": 1600000000000, "end": 1600000000000, "status": "success", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/overview-enclave.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/overview-enclave.json index 9d82ed97849..ef9c8a608ab 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/overview-enclave.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/overview-enclave.json @@ -5,11 +5,11 @@ "steps": [ { "type": "instance", - "dependencies": [], + "dependencies": [ ], "declared": true, "instance": "default", "readyAt": 0, - "deploying": {}, + "deploying": { }, "latestVersions": { "platform": { "platform": "6.1.0", @@ -21,7 +21,7 @@ "upgrade": false } ], - "blockers": [] + "blockers": [ ] }, "application": { "application": { @@ -42,21 +42,21 @@ } } ], - "blockers": [] + "blockers": [ ] } }, "delayCause": null }, { "type": "test", - "dependencies": [], + "dependencies": [ ], "declared": true, "instance": "default", "readyAt": 0, "jobName": "staging-test", "url": "https://some.url:43/instance/default/job/staging-test", "environment": "staging", - "toRun": [], + "toRun": [ ], "enclave": { "cloudAccount": "aws:123456789012" }, @@ -67,6 +67,11 @@ "start": 1600000000000, "end": 1600000000000, "status": "success", + "dependent": { + "instance": "default", + "region": "aws-us-east-1c", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -140,14 +145,14 @@ }, { "type": "test", - "dependencies": [], + "dependencies": [ ], "declared": true, "instance": "default", "readyAt": 0, "jobName": "system-test", "url": "https://some.url:43/instance/default/job/system-test", "environment": "test", - "toRun": [], + "toRun": [ ], "enclave": { "cloudAccount": "aws:123456789012" }, @@ -158,6 +163,11 @@ "start": 1600000000000, "end": 1600000000000, "status": "success", + "dependent": { + "instance": "default", + "region": "aws-us-east-1c", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -215,7 +225,11 @@ }, { "type": "deployment", - "dependencies": [0, 1, 2], + "dependencies": [ + 0, + 1, + 2 + ], "declared": true, "instance": "default", "readyAt": 1600000000000, @@ -230,7 +244,7 @@ "sourceUrl": "repository1/tree/commit1", "commit": "commit1" }, - "toRun": [], + "toRun": [ ], "enclave": { "cloudAccount": "aws:123456789012" }, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-runs.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-runs.json index 6c966f0de4d..6509611c3b3 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-runs.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-runs.json @@ -6,6 +6,11 @@ "start": 14503000, "end": 14503000, "status": "installationFailed", + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -87,6 +92,11 @@ "start": 14403000, "end": 14403000, "status": "installationFailed", + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -168,6 +178,11 @@ "start": 14403000, "end": 14403000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 3 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -249,6 +264,11 @@ "start": 1000, "end": 1000, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 2 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -330,6 +350,11 @@ "start": 0, "end": 0, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json index ae44c851dc0..e825ca1f6ad 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json @@ -1,6 +1,11 @@ { "active": false, "status": "installationFailed", + "dependent": { + "instance": "default", + "region": "us-east-3", + "build": 3 + }, "log": { "deployTester": [ { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json index c79dcc99ecf..bb8024ff3ca 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json @@ -1,6 +1,11 @@ { "active": false, "status": "success", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 1 + }, "log": { "deployTester": [ { 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 1ac4658ce10..0d6ae341be4 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 @@ -5,6 +5,11 @@ "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test/run/2", "start": 1600000000000, "status": "running", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 4 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { @@ -63,6 +68,11 @@ "start": 1600000000000, "end": 1600000000000, "status": "success", + "dependent": { + "instance": "instance1", + "region": "us-central-1", + "build": 1 + }, "versions": { "targetPlatform": "6.1.0", "targetApplication": { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json index 830512f2fcd..17f158ac9fc 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json @@ -1,6 +1,11 @@ { "active": false, "status": "success", + "dependent": { + "instance": "default", + "region": "us-central-1", + "build": 1 + }, "log": { "deployTester": [ { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java index d029987707f..b9da87771c0 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java @@ -22,6 +22,7 @@ import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.Instance; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificate; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint; import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer; import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; import com.yahoo.vespa.hosted.controller.api.integration.dns.Record.Type; @@ -1091,6 +1092,7 @@ public class RoutingPoliciesTest { assertEquals(2, generated.cluster(cluster1).size()); assertEquals(1, generated.cluster(cluster1).authMethod(AuthMethod.token).size()); } + Map<DeploymentId, Set<ContainerEndpoint>> containerEndpointsInProd = tester.containerEndpoints(Environment.prod); // Ordinary endpoints point to expected targets tester.assertTargets(context.instanceId(), EndpointId.of("foo"), cluster0, 0, @@ -1109,6 +1111,7 @@ public class RoutingPoliciesTest { // Next deployment does not change generated names context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.prod).deploy(); assertEquals(expectedRecords, tester.recordNames()); + assertEquals(containerEndpointsInProd, tester.containerEndpoints(Environment.prod)); } private void addCertificateToPool(String id, UnassignedCertificate.State state, RoutingPoliciesTester tester) { @@ -1200,6 +1203,12 @@ public class RoutingPoliciesTest { } } + public Map<DeploymentId, Set<ContainerEndpoint>> containerEndpoints(Environment environment) { + return tester.controllerTester().configServer().containerEndpoints().entrySet().stream() + .filter(kv -> kv.getKey().zoneId().environment() == environment) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + } + public RoutingPolicies routingPolicies() { return tester.controllerTester().controller().routing().policies(); } |