diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-03-08 21:00:06 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-03-08 21:00:06 +0100 |
commit | 57965fe6443e4f00c9852242091ce2da9845eb21 (patch) | |
tree | 84475c634427d07eebb73aaa296ee22530f8e8bd /controller-server/src | |
parent | f7d7f8a3e7387c650c2d6b882b30a57093cab5b0 (diff) |
Use configured tester flavour
Diffstat (limited to 'controller-server/src')
3 files changed, 14 insertions, 6 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index c1194244dd8..24721cafbe9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -500,11 +500,11 @@ public class InternalStepRunner implements StepRunner { /** Returns the application package for the tester application, assembled from a generated config, fat-jar and services.xml. */ private ApplicationPackage testerPackage(RunId id) { ApplicationVersion version = controller.jobController().run(id).get().versions().targetApplication(); + DeploymentSpec spec = controller.applications().require(id.application()).deploymentSpec(); + byte[] servicesXml = servicesXml(controller.system(), testerFlavorFor(id, spec)); byte[] testPackage = controller.applications().applicationStore().get(id.tester(), version); - byte[] servicesXml = servicesXml(controller.system()); - DeploymentSpec spec = controller.applications().require(id.application()).deploymentSpec(); ZoneId zone = id.type().zone(controller.system()); byte[] deploymentXml = deploymentXml(spec.athenzDomain(), spec.athenzService(zone.environment(), zone.region())); @@ -517,6 +517,14 @@ public class InternalStepRunner implements StepRunner { } } + private static Optional<String> testerFlavorFor(RunId id, DeploymentSpec spec) { + for (DeploymentSpec.Step step : spec.steps()) + if (step.deploysTo(id.type().environment())) + return step.zones().get(0).testerFlavor(); + + throw new IllegalStateException("No step deploys to the zone this run is for!"); + } + /** Returns a stream containing the zone of the deployment tested in the given run, and all production zones for the application. */ private Set<ZoneId> testedZoneAndProductionZones(RunId id) { return Stream.concat(Stream.of(id.type().zone(controller.system())), @@ -543,7 +551,7 @@ public class InternalStepRunner implements StepRunner { } /** Returns the generated services.xml content for the tester application. */ - static byte[] servicesXml(SystemName systemName) { + static byte[] servicesXml(SystemName systemName, Optional<String> testerFlavor) { String domain = systemName == SystemName.main ? "vespa.vespa" : "vespa.vespa.cd"; String servicesXml = @@ -586,7 +594,7 @@ public class InternalStepRunner implements StepRunner { " </filtering>\n" + " </http>\n" + "\n" + - " <nodes count=\"1\" flavor=\"d-1-4-50\" />\n" + + " <nodes count=\"1\" flavor=\"" + testerFlavor.orElse("d-1-4-50") + "\" />\n" + " </container>\n" + "</services>\n"; 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 686cd1c8dfa..f941e2ba7ca 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 @@ -292,7 +292,7 @@ public class InternalStepRunnerTest { @Test public void generates_correct_services_xml_test() { - assertFile("test_runner_services.xml-cd", new String(InternalStepRunner.servicesXml(SystemName.cd))); + assertFile("test_runner_services.xml-cd", new String(InternalStepRunner.servicesXml(SystemName.cd, Optional.of("flavor")))); } private void assertFile(String resourceName, String actualContent) { diff --git a/controller-server/src/test/resources/test_runner_services.xml-cd b/controller-server/src/test/resources/test_runner_services.xml-cd index e0fca9716eb..b395d657e3d 100644 --- a/controller-server/src/test/resources/test_runner_services.xml-cd +++ b/controller-server/src/test/resources/test_runner_services.xml-cd @@ -37,6 +37,6 @@ </filtering> </http> - <nodes count="1" flavor="d-1-4-50" /> + <nodes count="1" flavor="flavor" /> </container> </services> |