diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-12-12 13:51:16 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-12-12 13:51:16 +0100 |
commit | 76eef21a18d0e5bef92090e0417fe0953e2b120b (patch) | |
tree | 5560dc8522530b1f29944d135d31b3cce4c78d13 /controller-server | |
parent | 49e5adcaf566d16aaddeb22a8dad591fa14d906b (diff) |
Make it possible to declare explicit tests in ApplicationPackageBuilder
Diffstat (limited to 'controller-server')
2 files changed, 22 insertions, 3 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java index 7684aa9e887..c4b4bc8790e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java @@ -50,6 +50,8 @@ public class ApplicationPackageBuilder { private String globalServiceId = null; private String athenzIdentityAttributes = null; private String searchDefinition = "search test { }"; + private boolean explicitSystemTest = false; + private boolean explicitStagingTest = false; public ApplicationPackageBuilder majorVersion(int majorVersion) { this.majorVersion = OptionalInt.of(majorVersion); @@ -88,6 +90,16 @@ public class ApplicationPackageBuilder { return this; } + public ApplicationPackageBuilder systemTest() { + explicitSystemTest = true; + return this; + } + + public ApplicationPackageBuilder stagingTest() { + explicitStagingTest = true; + return this; + } + public ApplicationPackageBuilder region(RegionName regionName) { return region(regionName.value()); } @@ -176,6 +188,10 @@ public class ApplicationPackageBuilder { xml.append(athenzIdentityAttributes); } xml.append(">\n"); + if (explicitSystemTest) + xml.append(" <test />\n"); + if (explicitStagingTest) + xml.append(" <staging />\n"); xml.append(" <instance id='").append(instances).append("'>\n"); if (upgradePolicy != null) { xml.append(" <upgrade policy='"); 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 dbbb2bff310..e52ceec34bd 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 @@ -182,6 +182,7 @@ public class DeploymentTriggerTest { @Test public void deploymentSpecWithDelays() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() + .systemTest() .environment(Environment.prod) .delay(Duration.ofSeconds(30)) .region("us-west-1") @@ -193,15 +194,17 @@ public class DeploymentTriggerTest { var app = tester.newDeploymentContext().submit(applicationPackage); // Test jobs pass - app.runJob(systemTest).runJob(stagingTest); + app.runJob(systemTest); + tester.clock().advance(Duration.ofSeconds(15)); + app.runJob(stagingTest); tester.triggerJobs(); // No jobs have started yet, as 30 seconds have not yet passed. assertEquals(0, tester.jobs().active().size()); - tester.clock().advance(Duration.ofSeconds(30)); + tester.clock().advance(Duration.ofSeconds(15)); tester.triggerJobs(); - // 30 seconds later, the first jobs may trigger. + // 30 seconds after the declared test, jobs may begin. The implicit test does not affect the delay. assertEquals(1, tester.jobs().active().size()); app.assertRunning(productionUsWest1); |