summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-07-10 14:16:25 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-07-10 14:16:25 +0200
commit47be1b89238105ca9f337f17706cd591265a47aa (patch)
tree331a0b6d9370b47951e26d05bfaaf53517c0e051
parent9baa67e082830e31e47b2881737351cb1828d64f (diff)
Use config parameter to find correct path for 'artifacts' subdirectory
Introduce new config for junit testrunner. Remove use of ConfigserverConfig and knowledge about system names.
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java7
-rw-r--r--controller-server/src/test/resources/test_runner_services.xml-cd-osgi7
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java18
-rw-r--r--vespa-osgi-testrunner/src/main/resources/configdefinitions/junit-test-runner.def5
4 files changed, 26 insertions, 11 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 0ef25d0f613..6bc0ec6baf8 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
@@ -869,7 +869,12 @@ public class InternalStepRunner implements StepRunner {
?
" <component id=\"" + runtimeProviderClass + "\" bundle=\"" + tenantCdBundle + "\" />\n" +
"\n" +
- " <component id=\"com.yahoo.vespa.testrunner.JunitRunner\" bundle=\"vespa-osgi-testrunner\" />\n" +
+ " <component id=\"com.yahoo.vespa.testrunner.JunitRunner\" bundle=\"vespa-osgi-testrunner\">\n" +
+ " <config name=\"com.yahoo.vespa.testrunner.junit-test-runner\">\n" +
+ " <artifactsPath>artifacts</artifactsPath>\n" +
+ " <useAthenzCredentials>" + systemUsesAthenz + "</useAthenzCredentials>\n" +
+ " </config>\n" +
+ " </component>\n" +
"\n" +
" <handler id=\"com.yahoo.vespa.testrunner.TestRunnerHandler\" bundle=\"vespa-osgi-testrunner\">\n" +
" <binding>http://*/tester/v1/*</binding>\n" +
diff --git a/controller-server/src/test/resources/test_runner_services.xml-cd-osgi b/controller-server/src/test/resources/test_runner_services.xml-cd-osgi
index 03277628156..d1a83abff8d 100644
--- a/controller-server/src/test/resources/test_runner_services.xml-cd-osgi
+++ b/controller-server/src/test/resources/test_runner_services.xml-cd-osgi
@@ -13,7 +13,12 @@
<component id="ai.vespa.hosted.cd.cloud.impl.VespaTestRuntimeProvider" bundle="cloud-tenant-cd" />
- <component id="com.yahoo.vespa.testrunner.JunitRunner" bundle="vespa-osgi-testrunner" />
+ <component id="com.yahoo.vespa.testrunner.JunitRunner" bundle="vespa-osgi-testrunner">
+ <config name="com.yahoo.vespa.testrunner.junit-test-runner">
+ <artifactsPath>artifacts</artifactsPath>
+ <useAthenzCredentials>true</useAthenzCredentials>
+ </config>
+ </component>
<handler id="com.yahoo.vespa.testrunner.TestRunnerHandler" bundle="vespa-osgi-testrunner">
<binding>http://*/tester/v1/*</binding>
diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
index 5fb7344dc74..7c86347a5b9 100644
--- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
+++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
@@ -4,10 +4,10 @@ package com.yahoo.vespa.testrunner;
import ai.vespa.hosted.api.TestDescriptor;
import ai.vespa.hosted.cd.internal.TestRuntimeProvider;
import com.google.inject.Inject;
-import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.component.AbstractComponent;
import com.yahoo.io.IOUtils;
import com.yahoo.jdisc.application.OsgiFramework;
+import com.yahoo.vespa.defaults.Defaults;
import com.yahoo.vespa.testrunner.legacy.LegacyTestRunner;
import org.junit.jupiter.engine.JupiterTestEngine;
import org.junit.platform.engine.discovery.DiscoverySelectors;
@@ -47,11 +47,11 @@ public class JunitRunner extends AbstractComponent {
@Inject
public JunitRunner(OsgiFramework osgiFramework,
- TestRuntimeProvider testRuntimeProvider,
- ConfigserverConfig configserverConfig) {
+ JunitTestRunnerConfig config,
+ TestRuntimeProvider testRuntimeProvider) {
this.testRuntimeProvider = testRuntimeProvider;
this.bundleContext = getUnrestrictedBundleContext(osgiFramework);
- uglyHackSetCredentialsRootSystemProperty(configserverConfig);
+ uglyHackSetCredentialsRootSystemProperty(config);
}
// Hack to retrieve bundle context that allows access to other bundles
@@ -66,13 +66,13 @@ public class JunitRunner extends AbstractComponent {
}
}
- // TODO(bjorncs|tokle) Propagate credentials root without ConfigserverConfig and system property
- private static void uglyHackSetCredentialsRootSystemProperty(ConfigserverConfig config) {
+ // TODO(bjorncs|tokle) Propagate credentials root without system property. Ideally move knowledge about path to test-runtime implementations
+ private static void uglyHackSetCredentialsRootSystemProperty(JunitTestRunnerConfig config) {
String credentialsRoot;
- if (config.system().equals("public") || config.system().equals("publiccd")) {
- credentialsRoot = "/opt/vespa/tmp/test/artifacts";
+ if (config.useAthenzCredentials()) {
+ credentialsRoot = Defaults.getDefaults().underVespaHome("var/vespa/sia");
} else {
- credentialsRoot = "/opt/vespa/var/vespa/sia";
+ credentialsRoot = config.artifactsPath().toString();
}
System.setProperty("vespa.test.credentials.root", credentialsRoot);
}
diff --git a/vespa-osgi-testrunner/src/main/resources/configdefinitions/junit-test-runner.def b/vespa-osgi-testrunner/src/main/resources/configdefinitions/junit-test-runner.def
new file mode 100644
index 00000000000..20a01014803
--- /dev/null
+++ b/vespa-osgi-testrunner/src/main/resources/configdefinitions/junit-test-runner.def
@@ -0,0 +1,5 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package=com.yahoo.vespa.testrunner
+
+artifactsPath path
+useAthenzCredentials bool default=false \ No newline at end of file