aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/test/java/com')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java18
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java16
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java58
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java94
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java143
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdaterTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java13
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentUpgraderTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java25
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RetriggerMaintainerTest.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TenantRoleMaintainerTest.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TrafficShareUpdaterTest.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java18
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/NotificationsSerializerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/complete-application.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java24
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java34
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiTest.java30
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java14
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json14
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepositoryTest.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java9
36 files changed, 325 insertions, 331 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
index 687820d15cc..e9619297a2f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
@@ -23,7 +23,6 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateMetadata;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
-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.dns.LatencyAliasTarget;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
@@ -61,11 +60,10 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.yahoo.config.provision.SystemName.main;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.devUsEast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -172,7 +170,7 @@ public class ControllerTest {
e.getMessage());
}
assertNotNull("Zone was not removed",
- context.instance().deployments().get(productionUsWest1.zone(main)));
+ context.instance().deployments().get(productionUsWest1.zone()));
// prod zone removal is allowed with override
applicationPackage = new ApplicationPackageBuilder()
@@ -182,7 +180,7 @@ public class ControllerTest {
.build();
context.submit(applicationPackage);
assertNull("Zone was removed",
- context.instance().deployments().get(productionUsWest1.zone(main)));
+ context.instance().deployments().get(productionUsWest1.zone()));
assertNull("Deployment job was removed", context.instanceJobs().get(productionUsWest1));
// Submission has stored application meta.
@@ -203,7 +201,7 @@ public class ControllerTest {
.get(tester.clock().instant()));
assertNull(tester.controllerTester().serviceRegistry().applicationStore()
- .getMeta(context.deploymentIdIn(productionUsWest1.zone(main))));
+ .getMeta(context.deploymentIdIn(productionUsWest1.zone())));
}
@Test
@@ -875,6 +873,8 @@ public class ControllerTest {
@Test
public void testDeployWithGlobalEndpointsInMultipleClouds() {
tester.controllerTester().zoneRegistry().setZones(
+ ZoneApiMock.fromId("test.us-west-1"),
+ ZoneApiMock.fromId("staging.us-west-1"),
ZoneApiMock.fromId("prod.us-west-1"),
ZoneApiMock.newBuilder().with(CloudName.from("aws")).withId("prod.aws-us-east-1").build()
);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java
index 84af9f4af85..df31883b1d5 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java
@@ -146,10 +146,10 @@ public class EndpointCertificatesTest {
"*.default.default.g.vespa-app.cloud",
"default.default.aws-us-east-1a.z.vespa-app.cloud",
"*.default.default.aws-us-east-1a.z.vespa-app.cloud",
- "default.default.aws-us-east-1c.test.z.vespa-app.cloud",
- "*.default.default.aws-us-east-1c.test.z.vespa-app.cloud",
- "default.default.aws-us-east-1c.staging.z.vespa-app.cloud",
- "*.default.default.aws-us-east-1c.staging.z.vespa-app.cloud"
+ "default.default.us-east-1.test.z.vespa-app.cloud",
+ "*.default.default.us-east-1.test.z.vespa-app.cloud",
+ "default.default.us-east-3.staging.z.vespa-app.cloud",
+ "*.default.default.us-east-3.staging.z.vespa-app.cloud"
);
Optional<EndpointCertificateMetadata> endpointCertificateMetadata = endpointCertificates.getMetadata(testInstance, testZone, DeploymentSpec.empty);
assertTrue(endpointCertificateMetadata.isPresent());
@@ -261,10 +261,10 @@ public class EndpointCertificatesTest {
"*.a1.t1.aws-us-east-1c.r.vespa-app.cloud",
"a1.t1.aws-us-east-1c.z.vespa-app.cloud",
"*.a1.t1.aws-us-east-1c.z.vespa-app.cloud",
- "a1.t1.aws-us-east-1c.test.z.vespa-app.cloud",
- "*.a1.t1.aws-us-east-1c.test.z.vespa-app.cloud",
- "a1.t1.aws-us-east-1c.staging.z.vespa-app.cloud",
- "*.a1.t1.aws-us-east-1c.staging.z.vespa-app.cloud"
+ "a1.t1.us-east-1.test.z.vespa-app.cloud",
+ "*.a1.t1.us-east-1.test.z.vespa-app.cloud",
+ "a1.t1.us-east-3.staging.z.vespa-app.cloud",
+ "*.a1.t1.us-east-3.staging.z.vespa-app.cloud"
);
Optional<EndpointCertificateMetadata> endpointCertificateMetadata = endpointCertificates.getMetadata(instance, zone1, applicationPackage.deploymentSpec());
assertTrue(endpointCertificateMetadata.isPresent());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java
index 3765f815e49..ad6a987d42b 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentContext.java
@@ -21,7 +21,6 @@ import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
@@ -78,6 +77,28 @@ import static org.junit.Assert.assertTrue;
*/
public class DeploymentContext {
+ public static final JobType systemTest = JobType.deploymentTo(ZoneId.from("test", "us-east-1"));
+ public static final JobType stagingTest = JobType.deploymentTo(ZoneId.from("staging", "us-east-3"));
+ public static final JobType productionUsEast3 = JobType.prod("us-east-3");
+ public static final JobType testUsEast3 = JobType.test("us-east-3");
+ public static final JobType productionUsWest1 = JobType.prod("us-west-1");
+ public static final JobType testUsWest1 = JobType.test("us-west-1");
+ public static final JobType productionUsCentral1 = JobType.prod("us-central-1");
+ public static final JobType testUsCentral1 = JobType.test("us-central-1");
+ public static final JobType productionApNortheast1 = JobType.prod("ap-northeast-1");
+ public static final JobType testApNortheast1 = JobType.test("ap-northeast-1");
+ public static final JobType productionApNortheast2 = JobType.prod("ap-northeast-2");
+ public static final JobType testApNortheast2 = JobType.test("ap-northeast-2");
+ public static final JobType productionApSoutheast1 = JobType.prod("ap-southeast-1");
+ public static final JobType testApSoutheast1 = JobType.test("ap-southeast-1");
+ public static final JobType productionEuWest1 = JobType.prod("eu-west-1");
+ public static final JobType testEuWest1 = JobType.test("eu-west-1");
+ public static final JobType productionAwsUsEast1a = JobType.prod("aws-us-east-1a");
+ public static final JobType testAwsUsEast1a = JobType.test("aws-us-east-1a");
+ public static final JobType devUsEast1 = JobType.dev("us-east-1");
+ public static final JobType devAwsUsEast2a = JobType.dev("aws-us-east-2a");
+ public static final JobType perfUsEast3 = JobType.perf("us-east-3");
+
private final AtomicLong salt = new AtomicLong();
// Application packages are expensive to construct, and a given test typically only needs to the test in the context
@@ -198,10 +219,10 @@ public class DeploymentContext {
.allMatch(deployment -> deployment.version().equals(version))));
for (var spec : application().deploymentSpec().instances())
- for (JobType type : new DeploymentSteps(spec, tester.controller()::system).productionJobs())
+ for (JobType type : new DeploymentSteps(spec, tester.controller().zoneRegistry()).productionJobs())
assertTrue(tester.configServer().nodeRepository()
- .list(type.zone(tester.controller().system()),
- NodeFilter.all().applications(applicationId.defaultInstance())).stream() // TODO jonmv: support more
+ .list(type.zone(),
+ NodeFilter.all().applications(applicationId.defaultInstance())).stream()
.allMatch(node -> node.currentVersion().equals(version)));
assertFalse(instance().change().hasTargets());
@@ -395,7 +416,7 @@ public class DeploymentContext {
/** Runs a deployment of the given package to the given manually deployable zone. */
public DeploymentContext runJob(ZoneId zone, ApplicationPackage applicationPackage) {
- return runJob(JobType.from(tester.controller().system(), zone).get(), applicationPackage, null);
+ return runJob(JobType.deploymentTo(zone), applicationPackage, null);
}
/** Pulls the ready job trigger, and then runs the whole of the given job in the instance of this, successfully. */
@@ -417,14 +438,13 @@ public class DeploymentContext {
}
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
assertEquals(unfinished, jobs.run(id).get().stepStatuses().get(Step.endTests));
tester.cloud().set(noTests ? Status.NO_TESTS : Status.FAILURE);
runner.advance(currentRun(job));
assertTrue(jobs.run(id).get().hasEnded());
assertEquals(noTests, jobs.run(id).get().hasSucceeded());
- assertTrue(configServer().nodeRepository().list(zone, NodeFilter.all().applications(TesterId.of(instanceId).id())).isEmpty());
+ assertTrue(configServer().nodeRepository().list(job.type().zone(), NodeFilter.all().applications(TesterId.of(instanceId).id())).isEmpty());
return this;
}
@@ -497,8 +517,8 @@ public class DeploymentContext {
tester.readyJobsTrigger().maintain();
if (type.isProduction()) {
- runJob(JobType.systemTest);
- runJob(JobType.stagingTest);
+ runJob(systemTest);
+ runJob(stagingTest);
tester.readyJobsTrigger().maintain();
}
@@ -511,8 +531,8 @@ public class DeploymentContext {
/** Start tests in system test stage */
public RunId startSystemTestTests() {
- var id = newRun(JobType.systemTest);
- var testZone = JobType.systemTest.zone(tester.controller().system());
+ var id = newRun(systemTest);
+ var testZone = systemTest.zone();
runner.run();
if ( ! deferDnsUpdates)
flushDnsUpdates();
@@ -537,7 +557,7 @@ public class DeploymentContext {
/** Deploys tester and real app, and completes tester and initial staging installation first if needed. */
private void doDeploy(JobId job) {
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
+ ZoneId zone = job.type().zone();
DeploymentId deployment = new DeploymentId(job.application(), zone);
// First step is always a deployment.
@@ -549,7 +569,7 @@ public class DeploymentContext {
if (job.type().isTest())
doInstallTester(job);
- if (job.type().equals(JobType.stagingTest)) { // Do the initial deployment and installation of the real application.
+ if (job.type().equals(stagingTest)) { // Do the initial deployment and installation of the real application.
assertEquals(unfinished, jobs.run(id).get().stepStatuses().get(Step.installInitialReal));
tester.configServer().nodeRepository().doUpgrade(deployment, Optional.empty(), tester.configServer().application(job.application(), zone).get().version().get());
configServer().convergeServices(id.application(), zone);
@@ -571,7 +591,7 @@ public class DeploymentContext {
/** Upgrades nodes to target version. */
private void doUpgrade(JobId job) {
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
+ ZoneId zone = job.type().zone();
DeploymentId deployment = new DeploymentId(job.application(), zone);
assertEquals(unfinished, jobs.run(id).get().stepStatuses().get(Step.installReal));
@@ -592,7 +612,7 @@ public class DeploymentContext {
/** Lets nodes converge on new application version. */
private void doConverge(JobId job) {
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
+ ZoneId zone = job.type().zone();
assertEquals(unfinished, jobs.run(id).get().stepStatuses().get(Step.installReal));
configServer().convergeServices(id.application(), zone);
@@ -608,7 +628,7 @@ public class DeploymentContext {
/** Installs tester and starts tests. */
private void doInstallTester(JobId job) {
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
+ ZoneId zone = job.type().zone();
assertEquals(unfinished, jobs.run(id).get().stepStatuses().get(Step.installTester));
configServer().nodeRepository().doUpgrade(new DeploymentId(TesterId.of(job.application()).id(), zone), Optional.empty(), tester.configServer().application(id.tester().id(), zone).get().version().get());
@@ -623,7 +643,7 @@ public class DeploymentContext {
/** Completes tests with success. */
private void doTests(JobId job) {
RunId id = currentRun(job).id();
- ZoneId zone = zone(job);
+ ZoneId zone = job.type().zone();
// All installation is complete and endpoints are ready, so tests may begin.
if (job.type().isDeployment())
@@ -645,10 +665,6 @@ public class DeploymentContext {
return new JobId(instanceId, type);
}
- private ZoneId zone(JobId job) {
- return job.type().zone(tester.controller().system());
- }
-
private ConfigServerMock configServer() {
return tester.configServer();
}
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 5a330b00809..4d4d94f9e1f 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
@@ -3,19 +3,15 @@ package com.yahoo.vespa.hosted.controller.deployment;
import com.yahoo.component.Version;
import com.yahoo.config.provision.InstanceName;
-import com.yahoo.config.provision.SystemName;
-import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.flags.PermanentFlags;
import com.yahoo.vespa.hosted.controller.ControllerTester;
import com.yahoo.vespa.hosted.controller.Instance;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
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.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
-import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock;
import com.yahoo.vespa.hosted.controller.versions.VespaVersion;
import org.junit.Assert;
import org.junit.Test;
@@ -23,7 +19,6 @@ import org.junit.Test;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -34,26 +29,23 @@ import java.util.stream.Collectors;
import static ai.vespa.validation.Validation.require;
import static com.yahoo.config.provision.SystemName.cd;
-import static com.yahoo.config.provision.SystemName.main;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionApNortheast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionApNortheast2;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionApSoutheast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionAwsUsEast1a;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionCdAwsUsEast1a;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionCdUsEast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionEuWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsCentral1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testApNortheast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testApNortheast2;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testAwsUsEast1a;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testEuWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testUsCentral1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionApNortheast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionApNortheast2;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionApSoutheast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionAwsUsEast1a;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionEuWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsCentral1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testApNortheast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testApNortheast2;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testAwsUsEast1a;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testEuWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testUsCentral1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testUsWest1;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.ChangesToCancel.ALL;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.ChangesToCancel.PLATFORM;
import static java.util.Collections.emptyList;
@@ -572,7 +564,7 @@ public class DeploymentTriggerTest {
tester.deploymentTrigger().forceTrigger(app.instanceId(), productionUsEast3, "mrTrigger", true, true, false);
app.assertRunning(productionUsEast3);
assertFalse(app.instance().jobPause(productionUsEast3).isPresent());
- assertEquals(app.deployment(productionUsEast3.zone(tester.controller().system())).version(),
+ assertEquals(app.deployment(productionUsEast3.zone()).version(),
tester.jobs().last(app.instanceId(), productionUsEast3).get().versions().targetPlatform());
}
@@ -641,7 +633,7 @@ public class DeploymentTriggerTest {
.runJob(productionUsEast3)
.runJob(productionUsWest1);
assertEquals(Change.empty(), app.instance().change());
- assertEquals(appVersion0, app.instance().deployments().get(productionUsEast3.zone(tester.controller().system())).revision());
+ assertEquals(appVersion0, app.instance().deployments().get(productionUsEast3.zone()).revision());
assertEquals(appVersion0, latestDeployed(app.instance()));
}
@@ -694,7 +686,7 @@ public class DeploymentTriggerTest {
tester.triggerJobs();
app1.jobAborted(systemTest).jobAborted(stagingTest);
app1.runJob(systemTest).runJob(stagingTest).timeOutConvergence(productionUsCentral1);
- assertEquals(version2, app1.deployment(productionUsCentral1.zone(main)).version());
+ assertEquals(version2, app1.deployment(productionUsCentral1.zone()).version());
Instant triggered = app1.instanceJobs().get(productionUsCentral1).lastTriggered().get().start();
tester.clock().advance(Duration.ofHours(1));
@@ -720,14 +712,14 @@ public class DeploymentTriggerTest {
assertEquals(Change.of(version1).with(revision2), app1.instance().change());
tester.triggerJobs();
app1.assertRunning(productionUsCentral1);
- assertEquals(version2, app1.instance().deployments().get(productionUsCentral1.zone(main)).version());
- assertEquals(revision1, app1.deployment(productionUsCentral1.zone(main)).revision());
+ assertEquals(version2, app1.instance().deployments().get(productionUsCentral1.zone()).version());
+ assertEquals(revision1, app1.deployment(productionUsCentral1.zone()).revision());
assertTrue(triggered.isBefore(app1.instanceJobs().get(productionUsCentral1).lastTriggered().get().start()));
// Change has a higher application version than what is deployed -- deployment should trigger.
app1.timeOutUpgrade(productionUsCentral1);
- assertEquals(version2, app1.deployment(productionUsCentral1.zone(main)).version());
- assertEquals(revision2, app1.deployment(productionUsCentral1.zone(main)).revision());
+ assertEquals(version2, app1.deployment(productionUsCentral1.zone()).version());
+ assertEquals(revision2, app1.deployment(productionUsCentral1.zone()).revision());
// Change is again strictly dominated, and us-central-1 is skipped, even though it is still failing.
tester.clock().advance(Duration.ofHours(3)); // Enough time for retry
@@ -760,8 +752,8 @@ public class DeploymentTriggerTest {
app.runJob(systemTest).runJob(stagingTest);
app.timeOutConvergence(productionEuWest1);
tester.deploymentTrigger().cancelChange(app.instanceId(), PLATFORM);
- assertEquals(v2, app.deployment(productionEuWest1.zone(main)).version());
- assertEquals(v1, app.deployment(productionUsEast3.zone(main)).version());
+ assertEquals(v2, app.deployment(productionEuWest1.zone()).version());
+ assertEquals(v1, app.deployment(productionUsEast3.zone()).version());
// New application version should run system and staging tests against both 6.1 and 6.2, in no particular order.
app.submit(applicationPackage);
@@ -1943,57 +1935,51 @@ public class DeploymentTriggerTest {
@Test
public void mixedDirectAndPipelineJobsInProduction() {
- ApplicationPackage cdPackage = new ApplicationPackageBuilder().region("cd-us-east-1")
- .region("cd-aws-us-east-1a")
+ ApplicationPackage cdPackage = new ApplicationPackageBuilder().region("us-east-3")
+ .region("aws-us-east-1a")
.build();
- List<ZoneId> zones = List.of(ZoneId.from("test.cd-us-west-1"),
- ZoneId.from("staging.cd-us-west-1"),
- ZoneId.from("prod.cd-us-east-1"),
- ZoneId.from("prod.cd-aws-us-east-1a"));
ControllerTester wrapped = new ControllerTester(cd);
- wrapped.setZones(zones)
- .setRoutingMethod(zones, RoutingMethod.sharedLayer4);
wrapped.upgradeSystem(Version.fromString("6.1"));
wrapped.computeVersionStatus();
DeploymentTester tester = new DeploymentTester(wrapped);
var app = tester.newDeploymentContext();
- app.runJob(productionCdUsEast1, cdPackage);
+ app.runJob(productionUsEast3, cdPackage);
app.submit(cdPackage);
app.runJob(systemTest);
// Staging test requires unknown initial version, and is broken.
- tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionCdUsEast1, "user", false, true, true);
- app.runJob(productionCdUsEast1)
+ tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionUsEast3, "user", false, true, true);
+ app.runJob(productionUsEast3)
.abortJob(stagingTest) // Complete failing run.
.runJob(stagingTest) // Run staging-test for production zone with no prior deployment.
- .runJob(productionCdAwsUsEast1a);
+ .runJob(productionAwsUsEast1a);
// Manually deploy to east again, then upgrade the system.
- app.runJob(productionCdUsEast1, cdPackage);
+ app.runJob(productionUsEast3, cdPackage);
var version = new Version("7.1");
tester.controllerTester().upgradeSystem(version);
tester.upgrader().maintain();
// System and staging tests both require unknown versions, and are broken.
- tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionCdUsEast1, "user", false, true, true);
- app.runJob(productionCdUsEast1)
+ tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionUsEast3, "user", false, true, true);
+ app.runJob(productionUsEast3)
.triggerJobs()
.jobAborted(systemTest)
.jobAborted(stagingTest)
.runJob(systemTest) // Run test for aws zone again.
.runJob(stagingTest) // Run test for aws zone again.
- .runJob(productionCdAwsUsEast1a);
+ .runJob(productionAwsUsEast1a);
// Deploy manually again, then submit new package.
- app.runJob(productionCdUsEast1, cdPackage);
+ app.runJob(productionUsEast3, cdPackage);
app.submit(cdPackage);
app.triggerJobs().runJob(systemTest);
// Staging test requires unknown initial version, and is broken.
- tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionCdUsEast1, "user", false, true, true);
- app.runJob(productionCdUsEast1)
+ tester.controller().applications().deploymentTrigger().forceTrigger(app.instanceId(), productionUsEast3, "user", false, true, true);
+ app.runJob(productionUsEast3)
.jobAborted(stagingTest)
.runJob(stagingTest)
- .runJob(productionCdAwsUsEast1a);
+ .runJob(productionAwsUsEast1a);
}
@Test
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
index 15f729e7a55..0dde6bd882f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
@@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
@@ -100,7 +99,7 @@ public class InternalStepRunnerTest {
tester.triggerJobs();
tester.runner().run();
DeploymentSpec spec = tester.configServer()
- .application(app.testerId().id(), JobType.stagingTest.zone(system())).get()
+ .application(app.testerId().id(), DeploymentContext.stagingTest.zone()).get()
.applicationPackage().deploymentSpec();
assertTrue(spec.instance(app.testerId().id().instance()).isPresent());
assertEquals("domain", spec.athenzDomain().get().value());
@@ -113,24 +112,24 @@ public class InternalStepRunnerTest {
"Exception to retry",
"test failure");
tester.configServer().throwOnNextPrepare(exception);
- tester.jobs().deploy(app.instanceId(), JobType.devUsEast1, Optional.empty(), applicationPackage());
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().stepStatuses().get(Step.deployReal));
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), applicationPackage());
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().stepStatuses().get(Step.deployReal));
tester.configServer().throwOnNextPrepare(exception);
tester.runner().run();
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().stepStatuses().get(Step.deployReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().stepStatuses().get(Step.deployReal));
tester.clock().advance(Duration.ofHours(1).plusSeconds(1));
tester.configServer().throwOnNextPrepare(exception);
tester.runner().run();
- assertEquals(failed, tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().stepStatuses().get(Step.deployReal));
- assertEquals(deploymentFailed, tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().status());
+ assertEquals(failed, tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().stepStatuses().get(Step.deployReal));
+ assertEquals(deploymentFailed, tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().status());
}
@Test
public void restartsServicesAndWaitsForRestartAndReboot() {
- RunId id = app.newRun(JobType.productionUsCentral1);
- ZoneId zone = id.type().zone(system());
+ RunId id = app.newRun(DeploymentContext.productionUsCentral1);
+ ZoneId zone = id.type().zone();
HostName host = tester.configServer().hostFor(instanceId, zone);
tester.runner().run();
@@ -151,28 +150,28 @@ public class InternalStepRunnerTest {
@Test
public void waitsForEndpointsAndTimesOut() {
- app.newRun(JobType.systemTest);
+ app.newRun(DeploymentContext.systemTest);
// Tester endpoint fails to show up for staging tests, and the real deployment for system tests.
- var testZone = JobType.systemTest.zone(system());
- var stagingZone = JobType.stagingTest.zone(system());
+ var testZone = DeploymentContext.systemTest.zone();
+ var stagingZone = DeploymentContext.stagingTest.zone();
tester.newDeploymentContext(app.testerId().id())
.deferLoadBalancerProvisioningIn(testZone.environment());
tester.newDeploymentContext(app.instanceId())
.deferLoadBalancerProvisioningIn(stagingZone.environment());
tester.runner().run();
- tester.configServer().convergeServices(app.instanceId(), JobType.stagingTest.zone(system()));
+ tester.configServer().convergeServices(app.instanceId(), DeploymentContext.stagingTest.zone());
tester.runner().run();
- tester.configServer().convergeServices(app.instanceId(), JobType.systemTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.systemTest.zone(system()));
- tester.configServer().convergeServices(app.instanceId(), JobType.stagingTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.stagingTest.zone(system()));
+ tester.configServer().convergeServices(app.instanceId(), DeploymentContext.systemTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.systemTest.zone());
+ tester.configServer().convergeServices(app.instanceId(), DeploymentContext.stagingTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.stagingTest.zone());
tester.runner().run();
tester.clock().advance(InternalStepRunner.Timeouts.of(system()).endpoint().plus(Duration.ofSeconds(1)));
tester.runner().run();
- assertEquals(failed, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(failed, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
}
@Test
@@ -180,66 +179,66 @@ public class InternalStepRunnerTest {
tester.controllerTester().upgradeSystem(new Version("7.1"));
tester.controllerTester().computeVersionStatus();
tester.upgrader().maintain();
- app.newRun(JobType.systemTest);
+ app.newRun(DeploymentContext.systemTest);
// Node is down too long in system test, and no nodes go down in staging.
tester.runner().run();
- tester.configServer().setVersion(tester.controller().readSystemVersion(), app.testerId().id(), JobType.systemTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.systemTest.zone(system()));
- tester.configServer().setVersion(tester.controller().readSystemVersion(), app.testerId().id(), JobType.stagingTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.stagingTest.zone(system()));
+ tester.configServer().setVersion(tester.controller().readSystemVersion(), app.testerId().id(), DeploymentContext.systemTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.systemTest.zone());
+ tester.configServer().setVersion(tester.controller().readSystemVersion(), app.testerId().id(), DeploymentContext.stagingTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.stagingTest.zone());
tester.runner().run();
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester));
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.stagingTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.stagingTest).get().stepStatuses().get(Step.installTester));
- Node systemTestNode = tester.configServer().nodeRepository().list(JobType.systemTest.zone(system()),
+ Node systemTestNode = tester.configServer().nodeRepository().list(DeploymentContext.systemTest.zone(),
NodeFilter.all().applications(app.instanceId())).iterator().next();
tester.clock().advance(InternalStepRunner.Timeouts.of(system()).noNodesDown().minus(Duration.ofSeconds(1)));
- tester.configServer().nodeRepository().putNodes(JobType.systemTest.zone(system()),
+ tester.configServer().nodeRepository().putNodes(DeploymentContext.systemTest.zone(),
Node.builder(systemTestNode)
.serviceState(Node.ServiceState.allowedDown)
.suspendedSince(tester.clock().instant())
.build());
tester.runner().run();
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.stagingTest).get().stepStatuses().get(Step.installInitialReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.stagingTest).get().stepStatuses().get(Step.installInitialReal));
tester.clock().advance(Duration.ofSeconds(2));
tester.runner().run();
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
- assertEquals(failed, tester.jobs().last(app.instanceId(), JobType.stagingTest).get().stepStatuses().get(Step.installInitialReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(failed, tester.jobs().last(app.instanceId(), DeploymentContext.stagingTest).get().stepStatuses().get(Step.installInitialReal));
tester.clock().advance(InternalStepRunner.Timeouts.of(system()).statelessNodesDown().minus(Duration.ofSeconds(3)));
tester.runner().run();
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
tester.clock().advance(Duration.ofSeconds(2));
tester.runner().run();
- assertEquals(failed, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(failed, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
}
@Test
public void startingTestsFailsIfDeploymentExpires() {
- app.newRun(JobType.systemTest);
+ app.newRun(DeploymentContext.systemTest);
tester.runner().run();
- tester.configServer().convergeServices(app.instanceId(), JobType.systemTest.zone(system()));
+ tester.configServer().convergeServices(app.instanceId(), DeploymentContext.systemTest.zone());
tester.runner().run();
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installTester));
- tester.applications().deactivate(app.instanceId(), JobType.systemTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.systemTest.zone(system()));
+ tester.applications().deactivate(app.instanceId(), DeploymentContext.systemTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.systemTest.zone());
tester.runner().run();
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester));
- assertEquals(failed, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.startTests));
- assertTrue(tester.jobs().last(app.instanceId(), JobType.systemTest).get().hasEnded());
- assertTrue(tester.jobs().last(app.instanceId(), JobType.systemTest).get().hasFailed());
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(failed, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.startTests));
+ assertTrue(tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().hasEnded());
+ assertTrue(tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().hasFailed());
}
@Test
public void alternativeEndpointsAreDetected() {
- var systemTestZone = JobType.systemTest.zone(system());
- var stagingZone = JobType.stagingTest.zone(system());
+ var systemTestZone = DeploymentContext.systemTest.zone();
+ var stagingZone = DeploymentContext.stagingTest.zone();
tester.controllerTester().zoneRegistry().exclusiveRoutingIn(ZoneApiMock.from(systemTestZone), ZoneApiMock.from(stagingZone));
var applicationPackage = new ApplicationPackageBuilder()
.athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service"))
@@ -251,15 +250,15 @@ public class InternalStepRunnerTest {
.triggerJobs();
tester.runner().run();
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
- assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(unfinished, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installTester));
app.flushDnsUpdates();
- tester.configServer().convergeServices(app.instanceId(), JobType.systemTest.zone(system()));
- tester.configServer().convergeServices(app.testerId().id(), JobType.systemTest.zone(system()));
+ tester.configServer().convergeServices(app.instanceId(), DeploymentContext.systemTest.zone());
+ tester.configServer().convergeServices(app.testerId().id(), DeploymentContext.systemTest.zone());
tester.runner().run();
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal));
- assertEquals(succeeded, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester));
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installReal));
+ assertEquals(succeeded, tester.jobs().last(app.instanceId(), DeploymentContext.systemTest).get().stepStatuses().get(Step.installTester));
}
@Test
@@ -324,7 +323,7 @@ public class InternalStepRunnerTest {
RunId id = app.startSystemTestTests();
tester.runner().run();
assertEquals(unfinished, tester.jobs().run(id).get().stepStatuses().get(Step.endTests));
- var testZone = JobType.systemTest.zone(system());
+ var testZone = DeploymentContext.systemTest.zone();
Inspector configObject = SlimeUtils.jsonToSlime(tester.cloud().config()).get();
assertEquals(app.instanceId().serializedForm(), configObject.field("application").asString());
assertEquals(testZone.value(), configObject.field("zone").asString());
@@ -377,7 +376,7 @@ public class InternalStepRunnerTest {
assertEquals(unfinished, tester.jobs().run(id).get().stepStatuses().get(Step.deployTester));
tester.clock().advance(JobRunner.jobTimeout);
- var testZone = JobType.systemTest.zone(tester.controller().system());
+ var testZone = DeploymentContext.systemTest.zone();
tester.runner().run();
app.flushDnsUpdates();
tester.configServer().convergeServices(app.instanceId(), testZone);
@@ -404,28 +403,28 @@ public class InternalStepRunnerTest {
@Test
public void deployToDev() {
- ZoneId zone = JobType.devUsEast1.zone(system());
- tester.jobs().deploy(app.instanceId(), JobType.devUsEast1, Optional.empty(), applicationPackage());
+ ZoneId zone = DeploymentContext.devUsEast1.zone();
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), applicationPackage());
tester.runner().run();
- RunId id = tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().id();
+ RunId id = tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().id();
assertEquals(unfinished, tester.jobs().run(id).get().stepStatuses().get(Step.installReal));
Version version = new Version("7.8.9");
Future<?> concurrentDeployment = Executors.newSingleThreadExecutor().submit(() -> {
- tester.jobs().deploy(app.instanceId(), JobType.devUsEast1, Optional.of(version), applicationPackage());
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.of(version), applicationPackage());
});
while ( ! concurrentDeployment.isDone())
tester.runner().run();
- assertEquals(id.number() + 1, tester.jobs().last(app.instanceId(), JobType.devUsEast1).get().id().number());
+ assertEquals(id.number() + 1, tester.jobs().last(app.instanceId(), DeploymentContext.devUsEast1).get().id().number());
ApplicationPackage otherPackage = new ApplicationPackageBuilder().region("us-central-1").build();
- tester.jobs().deploy(app.instanceId(), JobType.perfUsEast3, Optional.empty(), otherPackage);
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.perfUsEast3, Optional.empty(), otherPackage);
tester.runner().run(); // Job run order determined by JobType enum order per application.
tester.configServer().convergeServices(app.instanceId(), zone);
assertEquals(unfinished, tester.jobs().run(id).get().stepStatuses().get(Step.installReal));
assertEquals(applicationPackage().hash(), tester.configServer().application(app.instanceId(), zone).get().applicationPackage().hash());
- assertEquals(otherPackage.hash(), tester.configServer().application(app.instanceId(), JobType.perfUsEast3.zone(system())).get().applicationPackage().hash());
+ assertEquals(otherPackage.hash(), tester.configServer().application(app.instanceId(), DeploymentContext.perfUsEast3.zone()).get().applicationPackage().hash());
tester.configServer().setVersion(version, app.instanceId(), zone);
tester.runner().run();
@@ -435,7 +434,7 @@ public class InternalStepRunnerTest {
@Test
public void notificationIsSent() {
- app.submit().failDeployment(JobType.systemTest);
+ app.submit().failDeployment(DeploymentContext.systemTest);
MockMailer mailer = tester.controllerTester().serviceRegistry().mailer();
assertEquals(1, mailer.inbox("a@b").size());
assertEquals("Vespa application tenant.application: System test failing due to system error",
@@ -445,12 +444,12 @@ public class InternalStepRunnerTest {
mailer.inbox("b@a").get(0).subject());
// Re-run failing causes no additional email to be sent.
- app.failDeployment(JobType.systemTest);
+ app.failDeployment(DeploymentContext.systemTest);
assertEquals(1, mailer.inbox("a@b").size());
assertEquals(1, mailer.inbox("b@a").size());
// Failure with new package causes new email to be sent.
- app.submit().failDeployment(JobType.systemTest);
+ app.submit().failDeployment(DeploymentContext.systemTest);
assertEquals(2, mailer.inbox("a@b").size());
assertEquals(2, mailer.inbox("b@a").size());
}
@@ -506,7 +505,7 @@ public class InternalStepRunnerTest {
tester = new DeploymentTester(wrapped);
tester.configServer().bootstrap(tester.controllerTester().zoneRegistry().zones().all().ids(), SystemApplication.values());
app = tester.newDeploymentContext();
- RunId id = app.newRun(JobType.systemTest);
+ RunId id = app.newRun(DeploymentContext.systemTest);
tester.configServer().throwOnPrepare(instanceId -> {
if (instanceId.instance().isTester())
throw new ConfigServerException(ConfigServerException.ErrorCode.PARENT_HOST_NOT_READY, "provisioning", "deploy tester");
@@ -518,7 +517,7 @@ public class InternalStepRunnerTest {
List<X509Certificate> oldTrusted = new ArrayList<>(DeploymentContext.publicApplicationPackage().trustedCertificates());
X509Certificate oldCert = tester.jobs().run(id).get().testerCertificate().get();
oldTrusted.add(oldCert);
- assertEquals(oldTrusted, tester.configServer().application(app.instanceId(), id.type().zone(system())).get().applicationPackage().trustedCertificates());
+ assertEquals(oldTrusted, tester.configServer().application(app.instanceId(), id.type().zone()).get().applicationPackage().trustedCertificates());
tester.configServer().throwOnNextPrepare(null);
tester.runner().run();
@@ -528,27 +527,19 @@ public class InternalStepRunnerTest {
List<X509Certificate> newTrusted = new ArrayList<>(DeploymentContext.publicApplicationPackage().trustedCertificates());
X509Certificate newCert = tester.jobs().run(id).get().testerCertificate().get();
newTrusted.add(newCert);
- assertEquals(newTrusted, tester.configServer().application(app.instanceId(), id.type().zone(system())).get().applicationPackage().trustedCertificates());
+ assertEquals(newTrusted, tester.configServer().application(app.instanceId(), id.type().zone()).get().applicationPackage().trustedCertificates());
assertNotEquals(oldCert, newCert);
}
@Test
public void certificateTimeoutAbortsJob() {
- List<ZoneApiMock> zones = List.of(ZoneApiMock.fromId("test.aws-us-east-1c"),
- ZoneApiMock.fromId("staging.aws-us-east-1c"),
- ZoneApiMock.fromId("prod.aws-us-east-1c"));
- ControllerTester wrapped = new ControllerTester(SystemName.Public);
- wrapped.zoneRegistry()
- .setZones(zones)
- .setRoutingMethod(zones, RoutingMethod.exclusive);
- tester = new DeploymentTester(wrapped);
- tester.configServer().bootstrap(tester.controllerTester().zoneRegistry().zones().all().ids(), SystemApplication.values());
+ tester = new DeploymentTester(new ControllerTester(SystemName.Public));
app = tester.newDeploymentContext();
RunId id = app.startSystemTestTests();
List<X509Certificate> trusted = new ArrayList<>(DeploymentContext.publicApplicationPackage().trustedCertificates());
trusted.add(tester.jobs().run(id).get().testerCertificate().get());
- assertEquals(trusted, tester.configServer().application(app.instanceId(), id.type().zone(system())).get().applicationPackage().trustedCertificates());
+ assertEquals(trusted, tester.configServer().application(app.instanceId(), id.type().zone()).get().applicationPackage().trustedCertificates());
tester.clock().advance(InternalStepRunner.Timeouts.of(system()).testerCertificate().plus(Duration.ofSeconds(1)));
tester.runner().run();
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
index 61eca05cc67..59ee8cc6eae 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
@@ -7,7 +7,6 @@ import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.slime.SlimeUtils;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import com.yahoo.vespa.hosted.controller.application.EndpointId;
import org.junit.Test;
@@ -28,9 +27,9 @@ public class TestConfigSerializerTest {
@Test
public void testConfig() throws IOException {
- ZoneId zone = JobType.systemTest.zone(SystemName.PublicCd);
+ ZoneId zone = DeploymentContext.systemTest.zone();
byte[] json = new TestConfigSerializer(SystemName.PublicCd).configJson(instanceId,
- JobType.systemTest,
+ DeploymentContext.systemTest,
true,
Map.of(zone, List.of(Endpoint.of(ApplicationId.defaultId())
.target(EndpointId.of("ai"), ClusterSpec.Id.from("qrs"),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
index 1d8dba321a2..a4b17239626 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
@@ -55,11 +55,12 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry
public ZoneRegistryMock(SystemName system) {
this.system = system;
if (system.isPublic()) {
- this.zones = List.of(ZoneApiMock.fromId("test.aws-us-east-1c"),
- ZoneApiMock.fromId("staging.aws-us-east-1c"),
+ this.zones = List.of(ZoneApiMock.fromId("test.us-east-1"),
+ ZoneApiMock.fromId("staging.us-east-3"),
ZoneApiMock.fromId("prod.aws-us-east-1c"),
- ZoneApiMock.fromId("prod.aws-eu-west-1a"));
- setRoutingMethod(this.zones, RoutingMethod.exclusive);
+ ZoneApiMock.fromId("prod.aws-eu-west-1a"),
+ ZoneApiMock.fromId("dev.aws-us-east-1c"));
+ setRoutingMethod(this.zones, RoutingMethod.exclusive);
} else {
this.zones = List.of(ZoneApiMock.fromId("test.us-east-1"),
ZoneApiMock.fromId("staging.us-east-3"),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdaterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdaterTest.java
index 5f3c27ff060..c1d9c03819d 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdaterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ArchiveUriUpdaterTest.java
@@ -83,6 +83,7 @@ public class ArchiveUriUpdaterTest {
}
private void deploy(DeploymentContext application, ZoneId zone) {
- application.runJob(JobType.from(SystemName.Public, zone).orElseThrow(), new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
+ application.runJob(JobType.deploymentTo(zone), new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
}
+
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java
index 7f2799b6f58..f37a5a6893d 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
* @author ogronnesby
*/
public class CloudTrialExpirerTest {
+
private final ControllerTester tester = new ControllerTester(SystemName.PublicCd);
private final DeploymentTester deploymentTester = new DeploymentTester(tester);
private final CloudTrialExpirer expirer = new CloudTrialExpirer(tester.controller(), Duration.ofMinutes(5));
@@ -66,7 +67,7 @@ public class CloudTrialExpirerTest {
@Test
public void keep_inactive_trial_tenants_with_deployments() {
registerTenant("with-deployments", "trial", Duration.ofDays(30));
- registerDeployment("with-deployments", "my-app", "default", "aws-us-east-1c");
+ registerDeployment("with-deployments", "my-app", "default");
expirer.maintain();
assertPlan("with-deployments", "trial");
}
@@ -78,17 +79,12 @@ public class CloudTrialExpirerTest {
tester.controller().tenants().updateLastLogin(name, List.of(LastLoginInfo.UserLevel.user), tester.controller().clock().instant().minus(timeSinceLastLogin));
}
- private void registerDeployment(String tenantName, String appName, String instanceName, String regionName) {
- var zone = ZoneApiMock.newBuilder()
- .withSystem(tester.zoneRegistry().system())
- .withId("prod." + regionName)
- .build();
- tester.zoneRegistry().setZones(ZoneApiMock.fromId("test.aws-us-east-1c"), ZoneApiMock.fromId("staging.aws-us-east-1c"), zone);
+ private void registerDeployment(String tenantName, String appName, String instanceName) {
var app = tester.createApplication(tenantName, appName, instanceName);
var ctx = deploymentTester.newDeploymentContext(tenantName, appName, instanceName);
var pkg = new ApplicationPackageBuilder()
.instances("default")
- .region(regionName)
+ .region("aws-us-east-1c")
.trustDefaultCertificate()
.build();
ctx.submit(pkg).deploy();
@@ -97,4 +93,5 @@ public class CloudTrialExpirerTest {
private void assertPlan(String tenant, String planId) {
assertEquals(planId, tester.serviceRegistry().billingController().getPlan(TenantName.from(tenant)).value());
}
+
}
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 b39b791bb57..10a8bb79c2e 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
@@ -5,10 +5,10 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.Instance;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.deployment.Run;
import com.yahoo.vespa.hosted.controller.deployment.RunStatus;
@@ -40,7 +40,7 @@ public class DeploymentExpirerTest {
.build();
// Deploy dev
- devApp.runJob(JobType.devUsEast1, appPackage);
+ devApp.runJob(DeploymentContext.devUsEast1, appPackage);
// Deploy prod
prodApp.submit(appPackage).deploy();
@@ -55,8 +55,8 @@ public class DeploymentExpirerTest {
// Deploy dev unsuccessfully a few days before expiry
tester.clock().advance(Duration.ofDays(12));
tester.configServer().throwOnNextPrepare(new RuntimeException(getClass().getSimpleName()));
- tester.jobs().deploy(devApp.instanceId(), JobType.devUsEast1, Optional.empty(), appPackage);
- Run lastRun = tester.jobs().last(devApp.instanceId(), JobType.devUsEast1).get();
+ tester.jobs().deploy(devApp.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), appPackage);
+ Run lastRun = tester.jobs().last(devApp.instanceId(), DeploymentContext.devUsEast1).get();
assertSame(RunStatus.error, lastRun.status());
Deployment deployment = tester.applications().requireInstance(devApp.instanceId())
.deployments().get(devZone);
@@ -72,7 +72,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(), JobType.devUsEast1, lastRun.versions(), true, Optional.of("upgrade"));
+ tester.jobs().start(devApp.instanceId(), DeploymentContext.devUsEast1, lastRun.versions(), true, Optional.of("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/DeploymentIssueReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
index 812db107a26..637a8832533 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
@@ -21,9 +21,9 @@ import java.util.HashMap;
import java.util.Map;
import static com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy.canary;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.maxFailureAge;
import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.maxInactivity;
import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.upgradeGracePeriod;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainerTest.java
index 0b47cab3ac8..112519bb717 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainerTest.java
@@ -8,10 +8,10 @@ import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class DeploymentMetricsMaintainerTest {
@Test
public void updates_metrics() {
var application = tester.newDeploymentContext();
- application.runJob(JobType.devUsEast1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
+ application.runJob(DeploymentContext.devUsEast1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
DeploymentMetricsMaintainer maintainer = maintainer(tester.controller());
Supplier<Application> app = application::application;
@@ -51,7 +51,7 @@ public class DeploymentMetricsMaintainerTest {
assertFalse("Never received any writes", deployment.get().activity().lastWritten().isPresent());
// Metrics are gathered and saved to application
- application.runJob(JobType.devUsEast1, new ApplicationPackage(new byte[0]), Version.fromString("7.5.5"));
+ application.runJob(DeploymentContext.devUsEast1, new ApplicationPackage(new byte[0]), Version.fromString("7.5.5"));
var metrics0 = Map.of(ClusterMetrics.QUERIES_PER_SECOND, 1D,
ClusterMetrics.FEED_PER_SECOND, 2D,
ClusterMetrics.DOCUMENT_COUNT, 3D,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentUpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentUpgraderTest.java
index 07a23decd50..653ad2bb08a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentUpgraderTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentUpgraderTest.java
@@ -13,8 +13,8 @@ import org.junit.Test;
import java.time.Duration;
import java.time.Instant;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.devUsEast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.devUsEast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentUpgrader.mostLikelyWeeHour;
import static java.time.temporal.ChronoUnit.MILLIS;
import static org.junit.Assert.assertEquals;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java
index 3c80f9df843..6bcb4284a14 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java
@@ -15,9 +15,9 @@ import java.time.Duration;
import java.util.List;
import java.util.Optional;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
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 610d8d4ca9a..19971a0ee5b 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
@@ -3,12 +3,10 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
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.api.integration.deployment.SourceRevision;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
@@ -43,8 +41,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.aborted;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.error;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.reset;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
index 658fbccd660..64e3a95605a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
@@ -10,8 +10,11 @@ import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.UpgradePolicy;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.container.jdisc.HttpRequest;
+import com.yahoo.vespa.athenz.utils.AthenzIdentities;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.ControllerTester;
+import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzDbMock;
+import com.yahoo.vespa.hosted.controller.api.integration.athenz.ZmsClientMock;
import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter;
@@ -37,9 +40,9 @@ import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -50,6 +53,7 @@ import static org.junit.Assert.assertTrue;
public class MetricsReporterTest {
private final MetricsMock metrics = new MetricsMock();
+ private final ZmsClientMock zmsClient = new ZmsClientMock(new AthenzDbMock(), AthenzIdentities.from("mock.identity"));
@Test
public void audit_log_metric() {
@@ -553,6 +557,19 @@ public class MetricsReporterTest {
assertEquals("Upgrade is overdue measure relative to window 3", Duration.ofHours(34).plusMinutes(30), metric.get());
}
+ @Test
+ public void zms_quota_metrics() {
+ var tester = new ControllerTester();
+ var reporter = createReporter(tester.controller());
+ reporter.maintain();
+
+ assertEquals(0.1, metrics.getMetric(d -> "subdomains".equals(d.get("resourceType")), MetricsReporter.ZMS_QUOTA_USAGE).get());
+ assertEquals(0.2, metrics.getMetric(d -> "roles".equals(d.get("resourceType")), MetricsReporter.ZMS_QUOTA_USAGE).get());
+ assertEquals(0.3, metrics.getMetric(d -> "policies".equals(d.get("resourceType")), MetricsReporter.ZMS_QUOTA_USAGE).get());
+ assertEquals(0.4, metrics.getMetric(d -> "services".equals(d.get("resourceType")), MetricsReporter.ZMS_QUOTA_USAGE).get());
+ assertEquals(0.5, metrics.getMetric(d -> "groups".equals(d.get("resourceType")), MetricsReporter.ZMS_QUOTA_USAGE).get());
+ }
+
private void assertNodeCount(String metric, int n, Version version) {
long nodeCount = metrics.getMetric((dimensions) -> version.toFullString().equals(dimensions.get("currentVersion")), metric)
.stream()
@@ -656,7 +673,7 @@ public class MetricsReporterTest {
}
private MetricsReporter createReporter(Controller controller) {
- return new MetricsReporter(controller, metrics);
+ return new MetricsReporter(controller, metrics, zmsClient);
}
private static String appDimension(ApplicationId id) {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RetriggerMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RetriggerMaintainerTest.java
index ccb2b6ebb74..bebecf8b52b 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RetriggerMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RetriggerMaintainerTest.java
@@ -4,9 +4,9 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.zone.ZoneId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.deployment.RetriggerEntry;
import org.junit.Test;
@@ -34,11 +34,11 @@ public class RetriggerMaintainerTest {
.build();
// Deploy app
- devApp.runJob(JobType.devUsEast1, appPackage);
+ devApp.runJob(DeploymentContext.devUsEast1, appPackage);
devApp.completeRollout();
// Trigger a run (to simulate a running job)
- tester.deploymentTrigger().reTrigger(applicationId, JobType.devUsEast1, null);
+ tester.deploymentTrigger().reTrigger(applicationId, DeploymentContext.devUsEast1, null);
// Add a job to the queue
tester.deploymentTrigger().reTriggerOrAddToQueue(devApp.deploymentIdIn(ZoneId.from("dev", "us-east-1")), null);
@@ -48,7 +48,7 @@ public class RetriggerMaintainerTest {
assertEquals(1, retriggerEntries.size());
// Adding to queue triggers abort
- devApp.jobAborted(JobType.devUsEast1);
+ devApp.jobAborted(DeploymentContext.devUsEast1);
assertEquals(0, tester.jobs().active(applicationId).size());
// The maintainer runs and will actually trigger dev us-east, but keeps the entry in queue to verify it was actually run
@@ -58,7 +58,7 @@ public class RetriggerMaintainerTest {
assertEquals(1, tester.jobs().active(applicationId).size());
// Run outstanding jobs
- devApp.runJob(JobType.devUsEast1);
+ devApp.runJob(DeploymentContext.devUsEast1);
assertEquals(0, tester.jobs().active(applicationId).size());
// Run maintainer again, should find that the job has already run successfully and will remove the entry.
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TenantRoleMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TenantRoleMaintainerTest.java
index 81daf0cbcfe..7026d975010 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TenantRoleMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TenantRoleMaintainerTest.java
@@ -5,9 +5,9 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.TenantName;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.integration.aws.MockRoleService;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import org.junit.Test;
@@ -35,11 +35,11 @@ public class TenantRoleMaintainerTest {
.build();
// Deploy dev apps
- devAppTenant1.runJob(JobType.devUsEast1, appPackage);
- devAppTenant2.runJob(JobType.devUsEast1, appPackage);
+ devAppTenant1.runJob(DeploymentContext.devUsEast1, appPackage);
+ devAppTenant2.runJob(DeploymentContext.devUsEast1, appPackage);
// Deploy perf apps
- perfAppTenant1.runJob(JobType.perfUsEast3, appPackage);
+ perfAppTenant1.runJob(DeploymentContext.perfUsEast3, appPackage);
// Deploy prod
prodAppTenant2.submit(appPackage).deploy();
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TrafficShareUpdaterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TrafficShareUpdaterTest.java
index 08af46d8d33..c59155cb162 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TrafficShareUpdaterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/TrafficShareUpdaterTest.java
@@ -6,8 +6,8 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.integration.NodeRepositoryMock;
import org.junit.Test;
@@ -33,7 +33,7 @@ public class TrafficShareUpdaterTest {
ZoneId prod1 = ZoneId.from("prod", "ap-northeast-1");
ZoneId prod2 = ZoneId.from("prod", "us-east-3");
ZoneId prod3 = ZoneId.from("prod", "us-west-1");
- application.runJob(JobType.productionApNortheast1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
+ application.runJob(DeploymentContext.productionApNortheast1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
// Single zone
setQpsMetric(50.0, application.application().id().defaultInstance(), prod1, tester);
@@ -42,7 +42,7 @@ public class TrafficShareUpdaterTest {
assertTrafficFraction(1.0, 1.0, application.instanceId(), prod1, tester);
// Two zones
- application.runJob(JobType.productionUsEast3, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
+ application.runJob(DeploymentContext.productionUsEast3, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
// - one cold
setQpsMetric(50.0, application.application().id().defaultInstance(), prod1, tester);
setQpsMetric(0.0, application.application().id().defaultInstance(), prod2, tester);
@@ -59,7 +59,7 @@ public class TrafficShareUpdaterTest {
assertTrafficFraction(0.47, 1.0, application.instanceId(), prod2, tester);
// Three zones
- application.runJob(JobType.productionUsWest1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
+ application.runJob(DeploymentContext.productionUsWest1, new ApplicationPackage(new byte[0]), Version.fromString("7.1"));
// - one cold
setQpsMetric(53.0, application.application().id().defaultInstance(), prod1, tester);
setQpsMetric(47.0, application.application().id().defaultInstance(), prod2, tester);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
index ef4bfdb568e..185c1e8c891 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java
@@ -28,12 +28,12 @@ import java.util.OptionalInt;
import java.util.Set;
import java.util.stream.Collectors;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.devUsEast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsCentral1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.devUsEast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsCentral1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.ChangesToCancel.ALL;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.ChangesToCancel.PIN;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.ChangesToCancel.PLATFORM;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
index 75b9b108377..4fbe21f11fb 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
@@ -11,10 +11,10 @@ import com.yahoo.path.Path;
import com.yahoo.test.ManualClock;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock;
import com.yahoo.vespa.hosted.controller.notify.Notifier;
import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb;
@@ -65,7 +65,7 @@ public class NotificationsDbTest {
notification(1201, Type.deployment, Level.error, NotificationSource.from(ApplicationId.from(tenant.value(), "app2", "instance2")), "instance msg"),
notification(1301, Type.deployment, Level.warning, NotificationSource.from(new DeploymentId(ApplicationId.from(tenant.value(), "app2", "instance2"), ZoneId.from("prod", "us-north-2"))), "deployment msg"),
notification(1401, Type.feedBlock, Level.error, NotificationSource.from(new DeploymentId(ApplicationId.from(tenant.value(), "app1", "instance1"), ZoneId.from("dev", "us-south-1")), ClusterSpec.Id.from("cluster1")), "cluster msg"),
- notification(1501, Type.deployment, Level.warning, NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), JobType.devUsEast1, 4)), "run id msg"));
+ notification(1501, Type.deployment, Level.warning, NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), DeploymentContext.devUsEast1, 4)), "run id msg"));
private final ManualClock clock = new ManualClock(Instant.ofEpochSecond(12345));
private final MockCuratorDb curatorDb = new MockCuratorDb(SystemName.Public);
@@ -78,8 +78,8 @@ public class NotificationsDbTest {
assertEquals(notificationIndices(0, 1, 2, 3), notificationsDb.listNotifications(NotificationSource.from(tenant), true));
assertEquals(notificationIndices(2, 3), notificationsDb.listNotifications(NotificationSource.from(TenantAndApplicationId.from(tenant.value(), "app2")), false));
assertEquals(notificationIndices(4, 5), notificationsDb.listNotifications(NotificationSource.from(ApplicationId.from(tenant.value(), "app1", "instance1")), false));
- assertEquals(notificationIndices(5), notificationsDb.listNotifications(NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), JobType.devUsEast1, 5)), false));
- assertEquals(List.of(), notificationsDb.listNotifications(NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), JobType.productionUsEast3, 4)), false));
+ assertEquals(notificationIndices(5), notificationsDb.listNotifications(NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), DeploymentContext.devUsEast1, 5)), false));
+ assertEquals(List.of(), notificationsDb.listNotifications(NotificationSource.from(new RunId(ApplicationId.from(tenant.value(), "app1", "instance1"), DeploymentContext.productionUsEast3, 4)), false));
}
@Test
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
index 5941812d66d..e60325a140a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
@@ -13,7 +13,6 @@ import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision;
import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId;
@@ -25,6 +24,7 @@ import com.yahoo.vespa.hosted.controller.application.DeploymentActivity;
import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics;
import com.yahoo.vespa.hosted.controller.application.QuotaUsage;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.RevisionHistory;
import com.yahoo.vespa.hosted.controller.metric.ApplicationMetrics;
import com.yahoo.vespa.hosted.controller.routing.rotation.RotationId;
@@ -55,7 +55,7 @@ import static org.junit.Assert.assertEquals;
public class ApplicationSerializerTest {
- private static final ApplicationSerializer APPLICATION_SERIALIZER = new ApplicationSerializer(SystemName.main);
+ private static final ApplicationSerializer APPLICATION_SERIALIZER = new ApplicationSerializer();
private static final Path testData = Paths.get("src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/");
private static final ZoneId zone1 = ZoneId.from("prod", "us-west-1");
private static final ZoneId zone2 = ZoneId.from("prod", "us-east-3");
@@ -102,7 +102,7 @@ public class ApplicationSerializerTest {
3);
assertEquals("https://github/org/repo/tree/commit1", applicationVersion1.sourceUrl().get());
- ApplicationVersion applicationVersion2 = ApplicationVersion.from(RevisionId.forDevelopment(31, new JobId(id1, JobType.productionUsEast3)),
+ ApplicationVersion applicationVersion2 = ApplicationVersion.from(RevisionId.forDevelopment(31, new JobId(id1, DeploymentContext.productionUsEast3)),
new SourceRevision("repo1", "branch1", "commit1"), "a@b",
Version.fromString("6.3.1"),
Instant.ofEpochMilli(496));
@@ -125,10 +125,10 @@ public class ApplicationSerializerTest {
Instant.ofEpochMilli(42))));
RevisionHistory revisions = RevisionHistory.ofRevisions(List.of(applicationVersion1),
- Map.of(new JobId(id1, JobType.productionUsEast3), List.of(applicationVersion2)));
+ Map.of(new JobId(id1, DeploymentContext.productionUsEast3), List.of(applicationVersion2)));
List<Instance> instances = List.of(new Instance(id1,
deployments,
- Map.of(JobType.systemTest, Instant.ofEpochMilli(333)),
+ Map.of(DeploymentContext.systemTest, Instant.ofEpochMilli(333)),
List.of(AssignedRotation.fromStrings("foo", "default", "my-rotation", Set.of("us-west-1"))),
rotationStatus,
Change.of(new Version("6.1"))),
@@ -188,10 +188,10 @@ public class ApplicationSerializerTest {
assertEquals(original.require(id1.instance()).deployments().get(zone1), serialized.require(id1.instance()).deployments().get(zone1));
assertEquals(original.require(id1.instance()).deployments().get(zone2), serialized.require(id1.instance()).deployments().get(zone2));
- assertEquals(original.require(id1.instance()).jobPause(JobType.systemTest),
- serialized.require(id1.instance()).jobPause(JobType.systemTest));
- assertEquals(original.require(id1.instance()).jobPause(JobType.stagingTest),
- serialized.require(id1.instance()).jobPause(JobType.stagingTest));
+ assertEquals(original.require(id1.instance()).jobPause(DeploymentContext.systemTest),
+ serialized.require(id1.instance()).jobPause(DeploymentContext.systemTest));
+ assertEquals(original.require(id1.instance()).jobPause(DeploymentContext.stagingTest),
+ serialized.require(id1.instance()).jobPause(DeploymentContext.stagingTest));
assertEquals(original.ownershipIssueId(), serialized.ownershipIssueId());
assertEquals(original.owner(), serialized.owner());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java
index e13c598f2a9..0f7f97d333a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/BufferedLogStoreTest.java
@@ -5,9 +5,9 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.SystemName;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockRunDataStore;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.RunLog;
import com.yahoo.vespa.hosted.controller.deployment.Step;
import org.junit.Test;
@@ -33,7 +33,7 @@ public class BufferedLogStoreTest {
RunDataStore store = new MockRunDataStore();
BufferedLogStore logs = new BufferedLogStore(chunkSize, chunkSize * maxChunks, buffer, store);
RunId id = new RunId(ApplicationId.from("tenant", "application", "instance"),
- JobType.productionUsWest1,
+ DeploymentContext.productionUsWest1,
123);
byte[] manyBytes = new byte[chunkSize / 2 + 1]; // One fits, and two (over-)fills.
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/NotificationsSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/NotificationsSerializerTest.java
index 0c8a773a132..1b82f622773 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/NotificationsSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/NotificationsSerializerTest.java
@@ -5,9 +5,9 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.TenantName;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeUtils;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.notification.Notification;
import com.yahoo.vespa.hosted.controller.notification.NotificationSource;
import org.junit.Test;
@@ -26,7 +26,7 @@ public class NotificationsSerializerTest {
@Test
public void serialization_test() throws IOException {
- NotificationsSerializer serializer = new NotificationsSerializer(main);
+ NotificationsSerializer serializer = new NotificationsSerializer();
TenantName tenantName = TenantName.from("tenant1");
List<Notification> notifications = List.of(
new Notification(Instant.ofEpochSecond(1234),
@@ -37,7 +37,7 @@ public class NotificationsSerializerTest {
new Notification(Instant.ofEpochSecond(2345),
Notification.Type.deployment,
Notification.Level.error,
- NotificationSource.from(new RunId(ApplicationId.from(tenantName.value(), "app1", "instance1"), JobType.systemTest, 12)),
+ NotificationSource.from(new RunId(ApplicationId.from(tenantName.value(), "app1", "instance1"), DeploymentContext.systemTest, 12)),
List.of("Failed to deploy: Node allocation failure")));
Slime serialized = serializer.toSlime(notifications);
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 a3b7932197b..fd0ea50e50b 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
@@ -6,12 +6,10 @@ import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.security.X509CertificateUtils;
import com.yahoo.slime.SlimeUtils;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
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.api.integration.deployment.SourceRevision;
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.RunStatus;
@@ -20,16 +18,12 @@ import com.yahoo.vespa.hosted.controller.deployment.StepInfo;
import org.junit.Test;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
-import java.util.OptionalLong;
import static com.yahoo.config.provision.SystemName.main;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.aborted;
@@ -59,10 +53,10 @@ import static org.junit.Assert.assertTrue;
public class RunSerializerTest {
- private static final RunSerializer serializer = new RunSerializer(main);
+ private static final RunSerializer serializer = new RunSerializer();
private static final Path runFile = Paths.get("src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json");
private static final RunId id = new RunId(ApplicationId.from("tenant", "application", "default"),
- JobType.productionUsEast3,
+ DeploymentContext.productionUsEast3,
112358);
private static final Instant start = Instant.parse("2007-12-03T10:15:30.00Z");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/complete-application.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/complete-application.json
index 29f748d5408..ec36f52c23a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/complete-application.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/complete-application.json
@@ -294,7 +294,7 @@
"deploymentJobs": {
"jobStatus": [
{
- "jobType": "staging-test",
+ "jobType": "staging.zone",
"pausedUntil": 321
}
]
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 85881fbfdbc..1216bcefab6 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
@@ -1,7 +1,7 @@
[
{
"id": "tenant:application:default",
- "type": "production-us-east-3",
+ "type": "prod.us-east-3",
"number": 112358,
"start": 1196676930000,
"sleepUntil": 1196676930100,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java
index ede753f9bf2..33b7500ceac 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java
@@ -402,7 +402,7 @@ public class ApplicationApiCloudTest extends ControllerContainerCloudTest {
.build();
new ControllerTester(tester).upgradeSystem(new Version("6.1"));
tester.controller().jobController().deploy(ApplicationId.from("scoober", "albums", "default"),
- JobType.productionAwsUsEast1c,
+ JobType.prod("aws-us-east-1c"),
Optional.empty(),
applicationPackage);
}
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 992ef59d9a5..6bfbb044944 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
@@ -41,7 +41,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.athenz.ApplicationActio
import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzDbMock;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact;
import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId;
@@ -52,6 +51,7 @@ import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.athenz.HostedAthenzIdentities;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger;
import com.yahoo.vespa.hosted.controller.integration.ConfigServerMock;
@@ -258,7 +258,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
.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);
+ app1.runJob(DeploymentContext.productionUsEast3);
tester.controller().applications().deactivate(app1.instanceId(), ZoneId.from("prod", "us-east-3"));
// POST (deploy) an application to start a manual deployment to dev
@@ -266,13 +266,13 @@ public class ApplicationApiTest extends ControllerContainerTest {
.data(entity)
.userIdentity(USER_ID),
"{\"message\":\"Deployment started in run 1 of dev-us-east-1 for tenant1.application1.instance1. This may take about 15 minutes the first time.\",\"run\":1}");
- app1.runJob(JobType.devUsEast1);
+ app1.runJob(DeploymentContext.devUsEast1);
// POST (deploy) a job to restart a manual deployment to dev
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/job/dev-us-east-1", POST)
.userIdentity(USER_ID),
"{\"message\":\"Triggered dev-us-east-1 for tenant1.application1.instance1\"}");
- app1.runJob(JobType.devUsEast1);
+ app1.runJob(DeploymentContext.devUsEast1);
// GET dev application package
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/job/dev-us-east-1/package", GET)
@@ -331,7 +331,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
.data(createApplicationSubmissionData(applicationPackageInstance1, 123)),
"{\"message\":\"application build 1, source revision of repository 'repository1', branch 'master' with commit 'commit1', by a@b, built against 6.1 at 1970-01-01T00:00:01Z\"}");
- app1.runJob(JobType.systemTest).runJob(JobType.stagingTest).runJob(JobType.productionUsCentral1);
+ app1.runJob(DeploymentContext.systemTest).runJob(DeploymentContext.stagingTest).runJob(DeploymentContext.productionUsCentral1);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
.withoutAthenzIdentity()
@@ -367,7 +367,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
.data("{ \"skipTests\": true, \"skipRevision\": true, \"skipUpgrade\": true }")
.userIdentity(USER_ID),
"{\"message\":\"Triggered production-us-west-1 for tenant2.application2.instance1, without revision and platform upgrade\"}");
- app2.runJob(JobType.productionUsWest1);
+ app2.runJob(DeploymentContext.productionUsWest1);
// POST a re-triggering to force a production job to start with previous parameters
tester.assertResponse(request("/application/v4/tenant/tenant2/application/application2/instance/instance1/job/production-us-west-1", POST)
@@ -729,11 +729,11 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Setup for test config tests
tester.controller().jobController().deploy(ApplicationId.from("tenant1", "application1", "default"),
- JobType.productionUsCentral1,
+ DeploymentContext.productionUsCentral1,
Optional.empty(),
applicationPackageDefault);
tester.controller().jobController().deploy(ApplicationId.from("tenant1", "application1", "my-user"),
- JobType.devUsEast1,
+ DeploymentContext.devUsEast1,
Optional.empty(),
applicationPackageDefault);
@@ -1092,7 +1092,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Create tenant and deploy
var app = deploymentTester.newDeploymentContext("tenant1", "application1", "instance1");
app.submit(applicationPackage).deploy();
- tester.controller().jobController().deploy(app.instanceId(), JobType.devUsEast1, Optional.empty(), applicationPackage);
+ tester.controller().jobController().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), applicationPackage);
assertEquals(Set.of(ZoneId.from("prod.us-west-1"), ZoneId.from("prod.us-east-3"), ZoneId.from("prod.eu-west-1"), ZoneId.from("dev.us-east-1")),
app.instance().deployments().keySet());
@@ -1616,7 +1616,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
assertEquals(1, activeGrants.size());
// Adding grant should trigger job
- app.assertRunning(JobType.productionUsWest1);
+ app.assertRunning(DeploymentContext.productionUsWest1);
// DELETE removes access
String disallowedResponse = grantResponse
@@ -1628,7 +1628,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
);
// Revoking access should trigger job
- app.assertRunning(JobType.productionUsWest1);
+ app.assertRunning(DeploymentContext.productionUsWest1);
// Should be no available grant
activeGrants = tester.controller().supportAccess().activeGrantsFor(new DeploymentId(ApplicationId.fromSerializedForm("tenant1:application1:instance1"), zone));
@@ -1836,7 +1836,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
Notification.Level.warning,
"Something something deprecated...");
tester.controller().notificationsDb().setNotification(
- NotificationSource.from(new RunId(ApplicationId.from(tenantName.value(), "app2", "instance1"), JobType.systemTest, 12)),
+ NotificationSource.from(new RunId(ApplicationId.from(tenantName.value(), "app2", "instance1"), DeploymentContext.systemTest, 12)),
Notification.Type.deployment,
Notification.Level.error,
"Failed to deploy: Node allocation failure");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java
index ee91787a36e..ac8bdafa2bd 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java
@@ -6,11 +6,11 @@ import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.slime.SlimeUtils;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import org.junit.Test;
@@ -24,14 +24,14 @@ import java.time.Instant;
import java.util.Optional;
import static com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException.ErrorCode.INVALID_APPLICATION_PACKAGE;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.devAwsUsEast2a;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.devUsEast1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsCentral1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.testUsCentral1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.devAwsUsEast2a;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.devUsEast1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsCentral1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.testUsCentral1;
import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.applicationPackage;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.deploymentFailed;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.installationFailed;
@@ -89,9 +89,9 @@ public class JobControllerApiHandlerHelperTest {
tester.clock().advance(Duration.ofHours(4).plusSeconds(1));
tester.runner().run();
assertEquals(installationFailed, tester.jobs().last(app.instanceId(), productionUsWest1).get().status());
- assertEquals(revision2, app.deployment(productionUsCentral1.zone(tester.controller().system())).revision());
- assertEquals(revision1, app.deployment(productionUsEast3.zone(tester.controller().system())).revision());
- assertEquals(revision2, app.deployment(productionUsWest1.zone(tester.controller().system())).revision());
+ assertEquals(revision2, app.deployment(productionUsCentral1.zone()).revision());
+ assertEquals(revision1, app.deployment(productionUsEast3.zone()).revision());
+ assertEquals(revision2, app.deployment(productionUsWest1.zone()).revision());
tester.clock().advance(Duration.ofMillis(1000));
@@ -104,7 +104,7 @@ public class JobControllerApiHandlerHelperTest {
assertEquals(running, tester.jobs().last(app.instanceId(), stagingTest).get().status());
// Staging deployment expires and the job fails, and is immediately retried.
- tester.controller().applications().deactivate(app.instanceId(), stagingTest.zone(tester.controller().system()));
+ tester.controller().applications().deactivate(app.instanceId(), stagingTest.zone());
tester.runner().run();
assertEquals(installationFailed, tester.jobs().last(app.instanceId(), stagingTest).get().status());
@@ -113,7 +113,7 @@ public class JobControllerApiHandlerHelperTest {
tester.triggerJobs();
tester.runner().run();
assertEquals(running, tester.jobs().last(app.instanceId(), stagingTest).get().status());
- tester.controller().applications().deactivate(app.instanceId(), stagingTest.zone(tester.controller().system()));
+ tester.controller().applications().deactivate(app.instanceId(), stagingTest.zone());
tester.runner().run();
assertEquals(installationFailed, tester.jobs().last(app.instanceId(), stagingTest).get().status());
@@ -149,8 +149,8 @@ public class JobControllerApiHandlerHelperTest {
var app = tester.newDeploymentContext();
tester.clock().setInstant(Instant.EPOCH);
- ZoneId zone = JobType.devUsEast1.zone(tester.controller().system());
- tester.jobs().deploy(app.instanceId(), JobType.devUsEast1, Optional.empty(), applicationPackage());
+ ZoneId zone = DeploymentContext.devUsEast1.zone();
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), applicationPackage());
tester.configServer().setLogStream(() -> "1554970337.935104\t17491290-v6-1.ostk.bm2.prod.ne1.yahoo.com\t5480\tcontainer\tstdout\tinfo\tERROR: Bundle canary-application [71] Unable to get module class path. (java.lang.NullPointerException)\n");
assertResponse(JobControllerApiHandlerHelper.runDetailsResponse(tester.jobs(), tester.jobs().last(app.instanceId(), devUsEast1).get().id(), null), "dev-us-east-1-log-first-part.json");
@@ -159,7 +159,7 @@ public class JobControllerApiHandlerHelperTest {
tester.runner().run();
assertResponse(JobControllerApiHandlerHelper.runDetailsResponse(tester.jobs(), tester.jobs().last(app.instanceId(), devUsEast1).get().id(), "8"), "dev-us-east-1-log-second-part.json");
- tester.jobs().deploy(app.instanceId(), JobType.devUsEast1, Optional.empty(), applicationPackage());
+ tester.jobs().deploy(app.instanceId(), DeploymentContext.devUsEast1, Optional.empty(), applicationPackage());
assertResponse(JobControllerApiHandlerHelper.jobTypeResponse(tester.controller(), app.instanceId(), URI.create("https://some.url:43/root")), "dev-overview.json");
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiTest.java
index c195b623c11..8db6bdf9a4a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiTest.java
@@ -2,9 +2,9 @@
package com.yahoo.vespa.hosted.controller.restapi.deployment;
import com.yahoo.vespa.hosted.controller.ControllerTester;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.restapi.ContainerTester;
import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest;
@@ -36,24 +36,24 @@ public class BadgeApiTest extends ControllerContainerTest {
.build();
application.submit(applicationPackage).deploy();
application.submit(applicationPackage)
- .runJob(JobType.systemTest)
- .runJob(JobType.stagingTest)
- .runJob(JobType.productionUsWest1)
- .runJob(JobType.productionAwsUsEast1a)
- .runJob(JobType.testUsWest1)
- .runJob(JobType.productionApSoutheast1)
- .failDeployment(JobType.testApSoutheast1);
+ .runJob(DeploymentContext.systemTest)
+ .runJob(DeploymentContext.stagingTest)
+ .runJob(DeploymentContext.productionUsWest1)
+ .runJob(DeploymentContext.productionAwsUsEast1a)
+ .runJob(DeploymentContext.testUsWest1)
+ .runJob(DeploymentContext.productionApSoutheast1)
+ .failDeployment(DeploymentContext.testApSoutheast1);
application.submit(applicationPackage)
- .failTests(JobType.systemTest, true)
- .runJob(JobType.stagingTest);
+ .failTests(DeploymentContext.systemTest, true)
+ .runJob(DeploymentContext.stagingTest);
for (int i = 0; i < 31; i++)
if ((i & 1) == 0)
- application.failDeployment(JobType.productionUsWest1);
+ application.failDeployment(DeploymentContext.productionUsWest1);
else
- application.triggerJobs().abortJob(JobType.productionUsWest1);
+ application.triggerJobs().abortJob(DeploymentContext.productionUsWest1);
application.triggerJobs();
- tester.controller().applications().deploymentTrigger().reTrigger(application.instanceId(), JobType.systemTest, "reason");
- tester.controller().applications().deploymentTrigger().reTrigger(application.instanceId(), JobType.testEuWest1, "reason");
+ tester.controller().applications().deploymentTrigger().reTrigger(application.instanceId(), DeploymentContext.systemTest, "reason");
+ tester.controller().applications().deploymentTrigger().reTrigger(application.instanceId(), DeploymentContext.testEuWest1, "reason");
tester.assertResponse(authenticatedRequest("http://localhost:8080/badge/v1/tenant/application/default"),
Files.readString(Paths.get(responseFiles + "overview.svg")), 200);
@@ -64,7 +64,7 @@ public class BadgeApiTest extends ControllerContainerTest {
// New change not reflected before cache entry expires.
tester.serviceRegistry().clock().advance(Duration.ofSeconds(59));
- application.runJob(JobType.productionUsWest1);
+ application.runJob(DeploymentContext.productionUsWest1);
tester.assertResponse(authenticatedRequest("http://localhost:8080/badge/v1/tenant/application/default/production-us-west-1?historyLength=32"),
Files.readString(Paths.get(responseFiles + "history.svg")), 200);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
index 53da8c515a7..d837b9e8264 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java
@@ -6,9 +6,9 @@ import com.yahoo.config.application.api.ValidationId;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.ControllerTester;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
+import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.restapi.ContainerTester;
import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest;
@@ -48,7 +48,7 @@ public class DeploymentApiTest extends ControllerContainerTest {
// Deploy application without any declared jobs on the oldest version.
var oldAppWithoutDeployment = deploymentTester.newDeploymentContext("tenant4", "application4", "default");
- oldAppWithoutDeployment.submit().failDeployment(JobType.systemTest);
+ oldAppWithoutDeployment.submit().failDeployment(DeploymentContext.systemTest);
oldAppWithoutDeployment.submit(emptyPackage);
// System upgrades to 5.0 for the other applications.
@@ -61,8 +61,8 @@ public class DeploymentApiTest extends ControllerContainerTest {
var otherProductionApp = deploymentTester.newDeploymentContext("tenant2", "application2", "i2");
var appWithoutDeployments = deploymentTester.newDeploymentContext("tenant3", "application3", "default");
failingApp.submit(applicationPackage).deploy();
- productionApp.submit(multiInstancePackage).runJob(JobType.systemTest).runJob(JobType.stagingTest).runJob(JobType.productionUsWest1);
- otherProductionApp.runJob(JobType.productionUsWest1);
+ productionApp.submit(multiInstancePackage).runJob(DeploymentContext.systemTest).runJob(DeploymentContext.stagingTest).runJob(DeploymentContext.productionUsWest1);
+ otherProductionApp.runJob(DeploymentContext.productionUsWest1);
// Deploy once so that job information is stored, then remove the deployment by submitting an empty deployment spec.
appWithoutDeployments.submit(applicationPackage).deploy();
@@ -75,13 +75,13 @@ public class DeploymentApiTest extends ControllerContainerTest {
// Applications upgrade, 1/2 succeed
deploymentTester.upgrader().maintain();
deploymentTester.triggerJobs();
- productionApp.runJob(JobType.systemTest).runJob(JobType.stagingTest).runJob(JobType.productionUsWest1);
- failingApp.failDeployment(JobType.systemTest).failDeployment(JobType.stagingTest);
+ productionApp.runJob(DeploymentContext.systemTest).runJob(DeploymentContext.stagingTest).runJob(DeploymentContext.productionUsWest1);
+ failingApp.failDeployment(DeploymentContext.systemTest).failDeployment(DeploymentContext.stagingTest);
deploymentTester.upgrader().maintain();
deploymentTester.triggerJobs();
// Application fails application change
- productionApp.submit(multiInstancePackage).failDeployment(JobType.systemTest);
+ productionApp.submit(multiInstancePackage).failDeployment(DeploymentContext.systemTest);
tester.controller().updateVersionStatus(censorConfigServers(VersionStatus.compute(tester.controller())));
tester.assertResponse(operatorRequest("http://localhost:8080/deployment/v1/"), new File("root.json"));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json
index 9c34f9410ee..13a6391d5da 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json
@@ -353,21 +353,21 @@
"jobs": [
"system-test",
"staging-test",
- "production-aws-us-east-1a",
- "test-aws-us-east-1a",
"production-ap-northeast-1",
"test-ap-northeast-1",
"production-ap-northeast-2",
"test-ap-northeast-2",
"production-ap-southeast-1",
"test-ap-southeast-1",
+ "production-aws-us-east-1a",
+ "test-aws-us-east-1a",
+ "production-eu-west-1",
+ "test-eu-west-1",
+ "production-us-central-1",
+ "test-us-central-1",
"production-us-east-3",
"test-us-east-3",
"production-us-west-1",
- "test-us-west-1",
- "production-us-central-1",
- "test-us-central-1",
- "production-eu-west-1",
- "test-eu-west-1"
+ "test-us-west-1"
]
}
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 fca3dde8f7d..303230b91ad 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
@@ -19,7 +19,6 @@ 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.configserver.LoadBalancer;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordData;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
@@ -410,10 +409,7 @@ public class RoutingPoliciesTest {
var context = tester.newDeploymentContext("tenant1", "app1", "default");
context.submit(applicationPackage).deploy();
var zone = ZoneId.from("dev", "us-east-1");
- var zoneApi = ZoneApiMock.from(zone.environment(), zone.region());
- tester.controllerTester().serviceRegistry().zoneRegistry()
- .setZones(zoneApi)
- .exclusiveRoutingIn(zoneApi);
+ tester.controllerTester().setRoutingMethod(List.of(zone), RoutingMethod.exclusive);
var prodRecords = Set.of("app1.tenant1.us-central-1.vespa.oath.cloud", "app1.tenant1.us-west-1.vespa.oath.cloud");
assertEquals(prodRecords, tester.recordNames());
@@ -624,7 +620,7 @@ public class RoutingPoliciesTest {
// Application starts deployment
context = context.submit(applicationPackage);
- for (var testJob : List.of(JobType.systemTest, JobType.stagingTest)) {
+ for (var testJob : List.of(DeploymentContext.systemTest, DeploymentContext.stagingTest)) {
context = context.runJob(testJob);
// Since runJob implicitly tears down the deployment and immediately deletes DNS records associated with the
// deployment, we consume only one DNS update at a time here
@@ -879,8 +875,8 @@ public class RoutingPoliciesTest {
var sharedRegion = RegionName.from("aws-us-east-1c");
return List.of(ZoneId.from(Environment.prod, sharedRegion),
ZoneId.from(Environment.prod, RegionName.from("aws-eu-west-1a")),
- ZoneId.from(Environment.staging, sharedRegion),
- ZoneId.from(Environment.test, sharedRegion));
+ ZoneId.from(Environment.staging, RegionName.from("us-east-3")),
+ ZoneId.from(Environment.test, RegionName.from("us-east-1")));
}
private static class RoutingPoliciesTester {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepositoryTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepositoryTest.java
index 02154470de2..277c8e1ef85 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepositoryTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepositoryTest.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.vespa.hosted.controller.ControllerTester;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.application.AssignedRotation;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
@@ -115,7 +114,7 @@ public class RotationRepositoryTest {
// We're now out of rotations and next deployment fails
var application3 = tester.newDeploymentContext("tenant3", "app3", "default");
application3.submit(applicationPackage)
- .runJobExpectingFailure(JobType.systemTest, Optional.of("out of rotations"));
+ .runJobExpectingFailure(DeploymentContext.systemTest, Optional.of("out of rotations"));
}
@Test
@@ -124,7 +123,7 @@ public class RotationRepositoryTest {
.globalServiceId("foo")
.region("us-east-3")
.build();
- application.submit(applicationPackage).runJobExpectingFailure(JobType.systemTest, Optional.of("less than 2 prod zones are defined"));
+ application.submit(applicationPackage).runJobExpectingFailure(DeploymentContext.systemTest, Optional.of("less than 2 prod zones are defined"));
}
@Test
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java
index 297410112d5..7a137d4e410 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.hosted.controller.versions;
import com.yahoo.component.Version;
-import com.yahoo.component.Vtag;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.SystemName;
@@ -31,10 +30,10 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
-import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsEast3;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.productionUsWest1;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.stagingTest;
+import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.systemTest;
import static java.util.stream.Collectors.toSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;