diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2020-08-28 09:06:31 +0200 |
---|---|---|
committer | Morten Tokle <mortent@verizonmedia.com> | 2020-08-28 09:06:31 +0200 |
commit | 57cb650dc6601c2da5644a9ed75391d2d2abb572 (patch) | |
tree | 895ce2e44b9dc267662a07543efd39701d4dc735 /vespa-osgi-testrunner/src/test/java/com | |
parent | 6b565b21a2808f13bf890ca4113e10b29063f5ba (diff) |
Handle report not ready
Diffstat (limited to 'vespa-osgi-testrunner/src/test/java/com')
-rw-r--r-- | vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/TestRunnerHandlerTest.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/TestRunnerHandlerTest.java b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/TestRunnerHandlerTest.java index 580404d3744..18e857089a0 100644 --- a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/TestRunnerHandlerTest.java +++ b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/TestRunnerHandlerTest.java @@ -79,6 +79,22 @@ public class TestRunnerHandlerTest { } @Test + public void returnsEmptyLogWhenReportNotReady() throws IOException { + TestRunner testRunner = mock(TestRunner.class); + when(testRunner.isSupported()).thenReturn(true); + when(testRunner.getReport()).thenReturn(null); + testRunnerHandler = new TestRunnerHandler( + Executors.newSingleThreadExecutor(), + AccessLog.voidAccessLog(), + testRunner, null); + + HttpResponse response = testRunnerHandler.handle(HttpRequest.createTestRequest("http://localhost:1234/tester/v1/log", GET)); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + response.render(out); + assertEquals("{\"logRecords\":[]}", new String(out.toByteArray())); + } + + @Test public void usesLegacyTestRunnerWhenNotSupported() throws IOException { TestRunner testRunner = mock(TestRunner.class); when(testRunner.isSupported()).thenReturn(false); |