diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-07-10 14:16:25 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-07-10 14:16:25 +0200 |
commit | 47be1b89238105ca9f337f17706cd591265a47aa (patch) | |
tree | 331a0b6d9370b47951e26d05bfaaf53517c0e051 /vespa-osgi-testrunner/src | |
parent | 9baa67e082830e31e47b2881737351cb1828d64f (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.
Diffstat (limited to 'vespa-osgi-testrunner/src')
-rw-r--r-- | vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java | 18 | ||||
-rw-r--r-- | vespa-osgi-testrunner/src/main/resources/configdefinitions/junit-test-runner.def | 5 |
2 files changed, 14 insertions, 9 deletions
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 |