aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-osgi-testrunner
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-11-18 14:38:20 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-11-18 14:38:20 +0100
commitf91cc57a8e8ff9b76611d5a2323ee6f071210fb9 (patch)
treecf38ef880c6d6468691e3a573ff6fc830791c715 /vespa-osgi-testrunner
parent94b5b00ee911f05992573a87e77255f4440a712f (diff)
Specify overrides for creds instead
Diffstat (limited to 'vespa-osgi-testrunner')
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java13
-rw-r--r--vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/VespaCliTestRunnerTest.java17
2 files changed, 6 insertions, 24 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 47bb5b866a3..35979ef5eb7 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
@@ -77,9 +77,6 @@ public class VespaCliTestRunner implements TestRunner {
Process process = null;
try {
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 -> {
@@ -99,12 +96,6 @@ public class VespaCliTestRunner implements TestRunner {
}
}
- 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)))
@@ -112,7 +103,9 @@ public class VespaCliTestRunner implements TestRunner {
ProcessBuilder builder = new ProcessBuilder("vespa", "test", suitePath.toAbsolutePath().toString(),
"--application", config.application().toFullString(),
- "--endpoints", toEndpointsConfig(config));
+ "--endpoints", toEndpointsConfig(config),
+ "--data-plane-public-cert", artifactsPath.resolve("cert").toAbsolutePath().toString(),
+ "--data-plane-private-key", artifactsPath.resolve("key").toAbsolutePath().toString());
builder.redirectErrorStream(true);
return builder;
}
diff --git a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/VespaCliTestRunnerTest.java b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/VespaCliTestRunnerTest.java
index 1bf50a596b9..be00f28d2c9 100644
--- a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/VespaCliTestRunnerTest.java
+++ b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/VespaCliTestRunnerTest.java
@@ -2,17 +2,14 @@
package com.yahoo.vespa.testrunner;
import ai.vespa.hosted.api.TestConfig;
-import com.yahoo.config.provision.ApplicationId;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.List;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -60,18 +57,10 @@ class VespaCliTestRunnerTest {
ProcessBuilder builder = runner.testRunProcessBuilder(TestRunner.Suite.SYSTEM_TEST, testConfig);
assertEquals(List.of("vespa", "test", systemTests.toAbsolutePath().toString(),
"--application", "t.a.i",
- "--endpoints", "{\"endpoints\":[{\"cluster\":\"default\",\"url\":\"https://dev.endpoint:443/\"}]}"),
+ "--endpoints", "{\"endpoints\":[{\"cluster\":\"default\",\"url\":\"https://dev.endpoint:443/\"}]}",
+ "--data-plane-public-cert", temp.resolve("cert").toAbsolutePath().toString(),
+ "--data-plane-private-key", temp.resolve("key").toAbsolutePath().toString()),
builder.command());
-
- Path credentialsPath = temp.resolve("creds");
- assertThrows(NoSuchFileException.class,
- () -> runner.copyCredentials(credentialsPath));
-
- Files.write(temp.resolve("key"), new byte[]{ 0 });
- Files.write(temp.resolve("cert"), new byte[]{ 1 });
- runner.copyCredentials(credentialsPath);
- assertArrayEquals(new byte[]{ 0 }, Files.readAllBytes(credentialsPath.resolve("data-plane-private-key.pem")));
- assertArrayEquals(new byte[]{ 1 }, Files.readAllBytes(credentialsPath.resolve("data-plane-public-cert.pem")));
}
}