integration: test2json: enable timestamps to fix zero-time test durations
Without these options set, test2json does not include a `Time` field in the generated JSON; {"Action":"run","Test":"TestCgroupNamespacesBuild"} {"Action":"output","Test":"TestCgroupNamespacesBuild","Output":"=== RUN TestCgroupNamespacesBuild\n"} {"Action":"output","Test":"TestCgroupNamespacesBuild","Output":"--- PASS: TestCgroupNamespacesBuild (1.70s)\n"} ... {"Action":"pass","Test":"TestCgroupNamespacesBuild"} As a result, `gotestsum` was not able to calculate test-duration, and reported `time="0.000000"` for all tests; <testcase classname="amd64.integration.build" name="TestCgroupNamespacesBuild" time="0.000000"></testcase> With this patch applied: {"Time":"2019-08-23T22:42:41.644361357Z","Action":"run","Package":"amd64.integration.build","Test":"TestCgroupNamespacesBuild"} {"Time":"2019-08-23T22:42:41.644367647Z","Action":"output","Package":"amd64.integration.build","Test":"TestCgroupNamespacesBuild","Output":"=== RUN TestCgroupNamespacesBuild\n"} {"Time":"2019-08-23T22:42:44.926933252Z","Action":"output","Package":"amd64.integration.build","Test":"TestCgroupNamespacesBuild","Output":"--- PASS: TestCgroupNamespacesBuild (3.28s)\n"} ... {"Time":"2019-08-23T22:42:44.927003836Z","Action":"pass","Package":"amd64.integration.build","Test":"TestCgroupNamespacesBuild","Elapsed":3.28} Which now correctly reports the test's duration: <testcase classname="amd64.integration.build" name="TestCgroupNamespacesBuild" time="3.280000"></testcase> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
f3be6b346f
commit
d2e00d62e2
|
@ -67,7 +67,7 @@ run_test_integration_suites() {
|
||||||
--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
|
--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
|
||||||
--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
|
--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
|
||||||
--raw-command \
|
--raw-command \
|
||||||
-- go tool test2json ./test.main ${flags}
|
-- go tool test2json -t ./test.main ${flags}
|
||||||
); then exit 1; fi
|
); then exit 1; fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue