aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment')
-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
4 files changed, 146 insertions, 154 deletions
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"),