diff options
Diffstat (limited to 'vespa-osgi-testrunner/src/main/java/com')
-rw-r--r-- | vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java index f65a4b60d35..703dfe6cd1b 100644 --- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java +++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java @@ -76,7 +76,11 @@ public class VespaCliTestRunner implements TestRunner { void runTests(Suite suite, byte[] config) { Process process = null; try { - process = testRunProcessBuilder(suite, toEndpointsConfig(config)).start(); + TestConfig testConfig = TestConfig.fromJson(config); + Path credentialsPath = artifactsPath.resolve(testConfig.application().toFullString()); + copyCredentials(credentialsPath); + + process = testRunProcessBuilder(suite, testConfig).start(); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); in.lines().forEach(line -> { if (line.length() > 1 << 13) @@ -95,12 +99,20 @@ public class VespaCliTestRunner implements TestRunner { } } - ProcessBuilder testRunProcessBuilder(Suite suite, String endpointsConfig) { + void copyCredentials(Path credentialsPath) throws IOException { + Files.createDirectories(credentialsPath); + Files.copy(artifactsPath.resolve("key"), credentialsPath.resolve("data-plane-private-key.pem")); + Files.copy(artifactsPath.resolve("cert"), credentialsPath.resolve("data-plane-public-cert.pem")); + } + + ProcessBuilder testRunProcessBuilder(Suite suite, TestConfig config) throws IOException { Path suitePath = getChildDirectory(artifactsPath, "tests") .flatMap(testsPath -> getChildDirectory(testsPath, toSuiteDirectoryName(suite))) .orElseThrow(() -> new IllegalStateException("No tests found, for suite '" + suite + "'")); - ProcessBuilder builder = new ProcessBuilder("vespa", "test", "--endpoints", endpointsConfig); + ProcessBuilder builder = new ProcessBuilder("vespa", "test", + "--application", config.application().toFullString(), + "--endpoints", toEndpointsConfig(config)); builder.redirectErrorStream(true); builder.directory(suitePath.toFile()); return builder; @@ -133,8 +145,7 @@ public class VespaCliTestRunner implements TestRunner { } } - static String toEndpointsConfig(byte[] testConfig) throws IOException { - TestConfig config = TestConfig.fromJson(testConfig); + static String toEndpointsConfig(TestConfig config) throws IOException { Cursor root = new Slime().setObject(); Cursor endpointsArray = root.setArray("endpoints"); config.deployments().get(config.zone()).forEach((cluster, url) -> { |