summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2018-08-13 15:39:48 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2018-08-13 15:39:48 +0200
commit000665e4e9d976c61c89f347b0d0ed92ff22a390 (patch)
tree17973721389ba808d4a654db8dc19b2e5f431e4a
parentd641a75c27960e3a4a4c400319b0d007ea9fb1de (diff)
Test tester config generation
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java14
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java14
3 files changed, 28 insertions, 5 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
index c2199c284f3..ff3f168a978 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
@@ -12,10 +12,14 @@ public class MockTesterCloud implements TesterCloud {
private byte[] logs = new byte[0];
private Status status = NOT_STARTED;
+ private byte[] config;
+ private URI testerUrl;
@Override
public void startTests(URI testerUrl, Suite suite, byte[] config) {
- status = RUNNING;
+ this.status = RUNNING;
+ this.config = config;
+ this.testerUrl = testerUrl;
}
@Override
@@ -33,4 +37,12 @@ public class MockTesterCloud implements TesterCloud {
this.status = status;
}
+ public byte[] config() {
+ return config;
+ }
+
+ public URI testerUrl() {
+ return testerUrl;
+ }
+
}
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 432bd90f434..e96f88e94ca 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
@@ -381,10 +381,7 @@ 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 = application(id.application()).deploymentJobs()
- .statusOf(id.type()).get()
- .lastTriggered().get()
- .application();
+ ApplicationVersion version = controller.jobController().run(id).get().versions().targetApplication();
byte[] testPackage = controller.applications().artifacts().getTesterPackage(testerOf(id.application()), version.id());
byte[] servicesXml = servicesXml(controller.system());
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 587eb4aeaa7..d1c9b9f9b7e 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
@@ -6,6 +6,9 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.SystemName;
+import com.yahoo.slime.ArrayTraverser;
+import com.yahoo.slime.Inspector;
+import com.yahoo.vespa.config.SlimeUtils;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RefeedAction;
@@ -29,6 +32,7 @@ import org.junit.Test;
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -323,6 +327,16 @@ public class InternalStepRunnerTest {
RunId id = startSystemTestTests();
runner.run();
assertEquals(unfinished, jobs.run(id).get().steps().get(Step.endTests));
+ assertEquals(URI.create(routing.endpoints(new DeploymentId(testerOf(appId), JobType.systemTest.zone(tester.controller().system()))).get(0).getEndpoint()),
+ cloud.testerUrl());
+ Inspector configObject = SlimeUtils.jsonToSlime(cloud.config()).get();
+ assertEquals(appId.serializedForm(), configObject.field("application").asString());
+ assertEquals(JobType.systemTest.zone(tester.controller().system()).value(), configObject.field("zone").asString());
+ assertEquals(tester.controller().system().name(), configObject.field("system").asString());
+ assertEquals(1, configObject.field("endpoints").children());
+ assertEquals(1, configObject.field("endpoints").field(JobType.systemTest.zone(tester.controller().system()).value()).entries());
+ configObject.field("endpoints").field(JobType.systemTest.zone(tester.controller().system()).value()).traverse((ArrayTraverser) (__, endpoint) ->
+ assertEquals(routing.endpoints(new DeploymentId(appId, JobType.systemTest.zone(tester.controller().system()))).get(0).getEndpoint(), endpoint.asString()));
cloud.set("Success!".getBytes(), TesterCloud.Status.SUCCESS);
runner.run();