diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-11-17 13:58:54 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-11-17 13:58:54 +0100 |
commit | bcd400f728dd80ad4d1100efc67b0a86d6b40360 (patch) | |
tree | fa07789297fad1994867e91a4923a315e00f6e83 /vespa-osgi-testrunner | |
parent | 2e228e6836ac35522d517d4218f5e81c23362768 (diff) |
Move TestProfile to module where it is used
Diffstat (limited to 'vespa-osgi-testrunner')
3 files changed, 9 insertions, 41 deletions
diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java index a0437f14c98..5c7bb1ccbd3 100644 --- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java +++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java @@ -13,24 +13,18 @@ import com.yahoo.exception.ExceptionUtils; import com.yahoo.slime.Cursor; import com.yahoo.slime.JsonFormat; import com.yahoo.slime.Slime; -import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.testrunner.legacy.LegacyTestRunner; -import com.yahoo.vespa.testrunner.legacy.TestProfile; import com.yahoo.yolean.Exceptions; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; -import java.nio.charset.StandardCharsets; import java.util.Collection; -import java.util.Collections; -import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; import java.util.logging.Level; import java.util.logging.LogRecord; -import java.util.stream.Collectors; import static com.yahoo.jdisc.Response.Status; @@ -105,14 +99,14 @@ public class TestRunnerHandler extends LoggingRequestHandler { final String path = request.getUri().getPath(); if (path.startsWith("/tester/v1/run/")) { String type = lastElement(path); - TestProfile testProfile = TestProfile.valueOf(type.toUpperCase() + "_TEST"); + LegacyTestRunner.Suite testSuite = LegacyTestRunner.Suite.valueOf(type.toUpperCase() + "_TEST"); byte[] config = request.getData().readAllBytes(); if (useOsgiMode) { - junitRunner.executeTests(categoryFromProfile(testProfile), config); + junitRunner.executeTests(categoryFromProfile(testSuite), config); log.info("Started tests of type " + type + " and status is " + junitRunner.getStatus()); return new Response("Successfully started " + type + " tests"); } else { - testRunner.test(testProfile, config); + testRunner.test(testSuite, config); log.info("Started tests of type " + type + " and status is " + testRunner.getStatus()); return new Response("Successfully started " + type + " tests"); } @@ -120,7 +114,7 @@ public class TestRunnerHandler extends LoggingRequestHandler { return new Response(Status.NOT_FOUND, "Not found: " + request.getUri().getPath()); } - TestDescriptor.TestCategory categoryFromProfile(TestProfile testProfile) { + TestDescriptor.TestCategory categoryFromProfile(LegacyTestRunner.Suite testProfile) { switch(testProfile) { case SYSTEM_TEST: return TestDescriptor.TestCategory.systemtest; case STAGING_SETUP_TEST: return TestDescriptor.TestCategory.stagingsetuptest; diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/LegacyTestRunner.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/LegacyTestRunner.java index 80122302d2c..fc25f7de6e5 100644 --- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/LegacyTestRunner.java +++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/LegacyTestRunner.java @@ -13,10 +13,14 @@ public interface LegacyTestRunner { Status getStatus(); - void test(TestProfile testProfile, byte[] config); + void test(Suite suite, byte[] config); enum Status { NOT_STARTED, RUNNING, FAILURE, ERROR, SUCCESS } + enum Suite { + SYSTEM_TEST, STAGING_SETUP_TEST, STAGING_TEST, PRODUCTION_TEST + } + }
\ No newline at end of file diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/TestProfile.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/TestProfile.java deleted file mode 100644 index ad65d150874..00000000000 --- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/legacy/TestProfile.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.testrunner.legacy; - -/** - * @author valerijf - * @author jvenstad - */ -public enum TestProfile { - - SYSTEM_TEST("system, com.yahoo.vespa.tenant.systemtest.base.SystemTest", true), - STAGING_SETUP_TEST("staging-setup", false), - STAGING_TEST("staging, com.yahoo.vespa.tenant.systemtest.base.StagingTest", true), - PRODUCTION_TEST("production, com.yahoo.vespa.tenant.systemtest.base.ProductionTest", false); - - private final String group; - private final boolean failIfNoTests; - - TestProfile(String group, boolean failIfNoTests) { - this.group = group; - this.failIfNoTests = failIfNoTests; - } - - public String group() { - return group; - } - - public boolean failIfNoTests() { - return failIfNoTests; - } -} |