aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-osgi-testrunner
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2021-12-01 14:29:46 +0100
committerHåkon Hallingstad <hakon@yahooinc.com>2021-12-01 14:29:46 +0100
commit439288419be9d8b06fd4603495614040a8c6663b (patch)
tree74772190a36e19220716143147b76eb354265699 /vespa-osgi-testrunner
parent7cff9f240f16e5c02d562a691bc81a3dba830218 (diff)
Set VESPA_CLI_HOME when invoking vespa cli
Diffstat (limited to 'vespa-osgi-testrunner')
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/VespaCliTestRunner.java13
1 files changed, 13 insertions, 0 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 8599babd0a5..22fee44756f 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
@@ -6,6 +6,7 @@ import com.google.inject.Inject;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeUtils;
+import com.yahoo.yolean.Exceptions;
import java.io.BufferedReader;
import java.io.IOException;
@@ -13,6 +14,7 @@ import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.attribute.FileAttribute;
import java.util.Collection;
import java.util.Optional;
import java.util.SortedMap;
@@ -28,6 +30,7 @@ import static com.yahoo.vespa.testrunner.TestRunner.Status.ERROR;
import static com.yahoo.vespa.testrunner.TestRunner.Status.FAILURE;
import static com.yahoo.vespa.testrunner.TestRunner.Status.RUNNING;
import static com.yahoo.vespa.testrunner.TestRunner.Status.SUCCESS;
+import static com.yahoo.yolean.Exceptions.uncheck;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
@@ -42,6 +45,8 @@ public class VespaCliTestRunner implements TestRunner {
private final Path testsPath;
private final AtomicReference<Status> status = new AtomicReference<>(Status.NOT_STARTED);
+ private Path vespaCliHome = null;
+
@Inject
public VespaCliTestRunner(VespaCliTestRunnerConfig config) {
this(config.artifactsPath(), config.testsPath());
@@ -99,6 +104,13 @@ public class VespaCliTestRunner implements TestRunner {
}
}
+ private Path ensureHomeDirectoryForVespaCli() {
+ if (vespaCliHome == null) {
+ vespaCliHome = uncheck(() -> Files.createTempDirectory(VespaCliTestRunner.class.getSimpleName()));
+ }
+ return vespaCliHome;
+ }
+
ProcessBuilder testRunProcessBuilder(Suite suite, TestConfig config) throws IOException {
Path suitePath = getChildDirectory(testsPath, toSuiteDirectoryName(suite))
.orElseThrow(() -> new IllegalStateException("No tests found, for suite '" + suite + "'"));
@@ -107,6 +119,7 @@ public class VespaCliTestRunner implements TestRunner {
"--application", config.application().toFullString(),
"--zone", config.zone().value());
builder.redirectErrorStream(true);
+ builder.environment().put("VESPA_CLI_HOME", ensureHomeDirectoryForVespaCli().toString());
builder.environment().put("VESPA_CLI_ENDPOINTS", toEndpointsConfig(config));
builder.environment().put("VESPA_CLI_DATA_PLANE_KEY_FILE", artifactsPath.resolve("key").toAbsolutePath().toString());
builder.environment().put("VESPA_CLI_DATA_PLANE_CERT_FILE", artifactsPath.resolve("cert").toAbsolutePath().toString());