diff options
Diffstat (limited to 'vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java')
-rw-r--r-- | vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java b/vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java index 8aa2cd7bc72..06f7d317b0e 100644 --- a/vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java +++ b/vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.SortedMap; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentSkipListMap; import java.util.function.Function; import java.util.logging.Level; @@ -112,24 +113,32 @@ public class TestRunner implements com.yahoo.vespa.testrunner.TestRunner { return builder; } - public synchronized void test(Suite suite, byte[] testConfig) { + @Override + public synchronized CompletableFuture<?> test(Suite suite, byte[] testConfig) { if (status == Status.RUNNING) throw new IllegalArgumentException("Tests are already running; should not receive this request now."); log.clear(); status = Status.RUNNING; - new Thread(() -> runTests(toProfile(suite), testConfig)).start(); + return CompletableFuture.runAsync(() -> runTests(toProfile(suite), testConfig)); } + @Override public Collection<LogRecord> getLog(long after) { return log.tailMap(after + 1).values(); } + @Override public synchronized Status getStatus() { return status; } + @Override + public boolean isSupported() { + return listFiles(artifactsPath).stream().anyMatch(file -> file.toString().endsWith("tests.jar")); + } + private void runTests(TestProfile testProfile, byte[] testConfig) { ProcessBuilder builder = testBuilder.apply(testProfile); { |