aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-08-10 18:34:34 +0200
committerjonmv <venstad@gmail.com>2022-08-10 18:34:34 +0200
commit33543be1fc9ea28cdc727b62155aa72ea0fc2dd3 (patch)
treec39f920864c7b2d73cc8cb712bea891a85966124
parent2e39740349f23b96307c504fd90312ff607517b1 (diff)
Remove legacy test report parts
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestRunnerHandler.java51
-rw-r--r--vespa-osgi-testrunner/src/test/resources/report.json71
2 files changed, 1 insertions, 121 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 ef4b402d33b..756c3f55ab3 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
@@ -150,61 +150,10 @@ public class TestRunnerHandler extends ThreadedHttpRequestHandler {
json.writeFieldName("report");
render(json, (Node) report.root());
- // TODO jonmv: remove
- json.writeObjectFieldStart("summary");
-
- renderSummary(json, report);
-
- json.writeArrayFieldStart("failures");
- renderFailures(json, report.root());
- json.writeEndArray();
-
- json.writeEndObject();
-
- // TODO jonmv: remove
- json.writeArrayFieldStart("output");
- renderOutput(json, report.root());
- json.writeEndArray();
-
json.writeEndObject();
json.close();
}
- private static void renderSummary(JsonGenerator json, TestReport report) throws IOException {
- Map<TestReport.Status, Long> tally = report.root().tally();
- json.writeNumberField("success", tally.getOrDefault(TestReport.Status.successful, 0L));
- json.writeNumberField("failed", tally.getOrDefault(TestReport.Status.failed, 0L) + tally.getOrDefault(TestReport.Status.error, 0L));
- json.writeNumberField("ignored", tally.getOrDefault(TestReport.Status.skipped, 0L));
- json.writeNumberField("aborted", tally.getOrDefault(TestReport.Status.aborted, 0L));
- json.writeNumberField("inconclusive", tally.getOrDefault(TestReport.Status.inconclusive, 0L));
- }
-
- private static void renderFailures(JsonGenerator json, Node node) throws IOException {
- if (node instanceof FailureNode) {
- json.writeStartObject();
- json.writeStringField("testName", node.parent.name());
- json.writeStringField("testError", ((FailureNode) node).thrown().getMessage());
- json.writeStringField("exception", ExceptionUtils.getStackTraceAsString(((FailureNode) node).thrown()));
- json.writeEndObject();
- }
- else {
- for (Node child : node.children())
- renderFailures(json, child);
- }
- }
-
- private static void renderOutput(JsonGenerator json, Node node) throws IOException {
- if (node instanceof OutputNode) {
- for (LogRecord record : ((OutputNode) node).log())
- if (record.getMessage() != null)
- json.writeString(formatter.format(record.getInstant().atOffset(ZoneOffset.UTC)) + " " + record.getMessage());
- }
- else {
- for (Node child : node.children())
- renderOutput(json, child);
- }
- }
-
private static void render(JsonGenerator json, Node node) throws IOException {
json.writeStartObject();
if (node instanceof NamedNode) render(json, (NamedNode) node);
diff --git a/vespa-osgi-testrunner/src/test/resources/report.json b/vespa-osgi-testrunner/src/test/resources/report.json
index 443694e2e0c..66ae6dd398c 100644
--- a/vespa-osgi-testrunner/src/test/resources/report.json
+++ b/vespa-osgi-testrunner/src/test/resources/report.json
@@ -482,74 +482,5 @@
]
}
]
- },
- "summary": {
- "success": 3,
- "failed": 5,
- "ignored": 4,
- "aborted": 1,
- "inconclusive": 1,
- "failures": [
- {
- "testName": "error()",
- "testError": null,
- "exception": "java.lang.NoClassDefFoundError\n\tat com.yahoo.vespa.test.samples.SampleTest.error(SampleTest.java:87)\n"
- },
- {
- "testName": "failing()",
- "testError": "baz ==> expected: <foo> but was: <bar>",
- "exception": "org.opentest4j.AssertionFailedError: baz ==> expected: <foo> but was: <bar>\n\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)\n\tat org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)\n\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)\n\tat org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1152)\n\tat com.yahoo.vespa.test.samples.SampleTest.failing(SampleTest.java:81)\n"
- },
- {
- "testName": "inconclusive(TestReporter)",
- "testError": "the cat is both dead _and_ alive",
- "exception": "ai.vespa.hosted.cd.InconclusiveTestException: the cat is both dead _and_ alive\n\tat com.yahoo.vespa.test.samples.SampleTest.inconclusive(SampleTest.java:93)\n"
- },
- {
- "testName": "third",
- "testError": "no charm",
- "exception": "org.opentest4j.AssertionFailedError: no charm\n\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:39)\n\tat org.junit.jupiter.api.Assertions.fail(Assertions.java:134)\n\tat com.yahoo.vespa.test.samples.SampleTest$Inner.lambda$others$1(SampleTest.java:105)\n"
- },
- {
- "testName": "test()",
- "testError": "",
- "exception": "org.opentest4j.AssertionFailedError\n\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:35)\n\tat org.junit.jupiter.api.Assertions.fail(Assertions.java:115)\n\tat com.yahoo.vespa.test.samples.FailingTestAndBothAftersTest.test(FailingTestAndBothAftersTest.java:19)\n\tSuppressed: java.lang.RuntimeException\n\t\tat com.yahoo.vespa.test.samples.FailingTestAndBothAftersTest.moreFail(FailingTestAndBothAftersTest.java:16)\n"
- },
- {
- "testName": "FailingTestAndBothAftersTest",
- "testError": null,
- "exception": "java.lang.RuntimeException\n\tat com.yahoo.vespa.test.samples.FailingTestAndBothAftersTest.fail(FailingTestAndBothAftersTest.java:13)\n"
- },
- {
- "testName": "WrongBeforeAllTest",
- "testError": "@BeforeAll method 'void com.yahoo.vespa.test.samples.WrongBeforeAllTest.wrong()' must be static unless the test class is annotated with @TestInstance(Lifecycle.PER_CLASS).",
- "exception": "org.junit.platform.commons.JUnitException: @BeforeAll method 'void com.yahoo.vespa.test.samples.WrongBeforeAllTest.wrong()' must be static unless the test class is annotated with @TestInstance(Lifecycle.PER_CLASS).\n"
- },
- {
- "testName": "test()",
- "testError": null,
- "exception": "java.lang.NullPointerException\n\tat com.yahoo.vespa.test.samples.FailingExtensionTest$FailingExtension.<init>(FailingExtensionTest.java:19)\n"
- },
- {
- "testName": "Production test",
- "testError": "School's out all summer!",
- "exception": "java.lang.ClassNotFoundException: School's out all summer!\n"
- }
- ]
- },
- "output": [
- "00:00:00.000 spam",
- "00:00:00.000 spam",
- "00:00:00.000 spam",
- "00:00:00.000 I have a bad feeling about this",
- "00:00:00.000 spam",
- "00:00:00.000 I'm here with Erwin today; Erwin, what can you tell us about your cat?",
- "00:00:00.000 spam",
- "00:00:00.000 <body />",
- "00:00:00.000 Very informative: \"\\n\": \n",
- "00:00:00.000 Oh no",
- "00:00:00.000 spam",
- "00:00:00.000 Catch me if you can!",
- "00:00:00.000 spam"
- ]
+ }
}