Store test logs in CI (#781)

* Capture test logs in CI

If test logs were saved, store them as CI artifacts

* Only keep logs for failed tests

* Catch tests who didn't define names into a generic filename

Signed-off-by: Horacio Mijail Anton Quiles <hmijail@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/827/head
Horacio Mijail Antón Quiles 5 years ago committed by GitHub
parent 3cc4dc3cff
commit 823a0f2817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .circleci/config.yml
  2. 34
      acceptance-tests/tests/src/test/resources/log4j2.xml
  3. 3
      build.gradle

@ -56,6 +56,13 @@ commands:
- store_test_results: - store_test_results:
path: build/test-results path: build/test-results
capture_test_logs:
description: "Capture test logs"
steps:
- store_artifacts:
path: acceptance-tests/tests/build/acceptanceTestLogs
destination: acceptance-tests-logs
jobs: jobs:
assemble: assemble:
executor: besu_executor_xl executor: besu_executor_xl
@ -152,6 +159,7 @@ jobs:
GRADLE_ARGS=$(echo $CLASSNAMES | awk '{for (i=1; i<=NF; i++) print "--tests",$i}') GRADLE_ARGS=$(echo $CLASSNAMES | awk '{for (i=1; i<=NF; i++) print "--tests",$i}')
./gradlew --no-daemon acceptanceTest $GRADLE_ARGS ./gradlew --no-daemon acceptanceTest $GRADLE_ARGS
- capture_test_results - capture_test_results
- capture_test_logs
buildDocker: buildDocker:
executor: besu_executor_med executor: besu_executor_med

@ -3,6 +3,7 @@
<Properties> <Properties>
<Property name="root.log.level">INFO</Property> <Property name="root.log.level">INFO</Property>
</Properties> </Properties>
<Appenders> <Appenders>
<Console name="Console" target="SYSTEM_OUT"> <Console name="Console" target="SYSTEM_OUT">
<PatternLayout> <PatternLayout>
@ -13,11 +14,27 @@
<Console name="SubProcessConsole" target="SYSTEM_OUT"> <Console name="SubProcessConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%X{test} | %X{node} | %msg%n" /> <PatternLayout pattern="%X{test} | %X{node} | %msg%n" />
</Console> </Console>
<Routing name="PerTestFile"> <Routing name="PerTestFile">
<Routes pattern="${ctx:class}-${ctx:test}"> <Routes pattern="${ctx:class}-${ctx:test}">
<Route key="$${ctx:class}-$${ctx:test}">
<!-- The class and test names failed to resolve, so use a catch-all filename -->
<File
name="Appends to AllTestsMissingExtraLoggingConf.log"
filename="build/acceptanceTestLogs/AllTestsMissingExtraLoggingConf.log"
append="true"
createOnDemand="true"
>
<PatternLayout>
<pattern>%X{node} | %d{HH:mm:ss.SSS} | %t | %-5level | %c{1} | %msg%n</pattern>
<replace regex="^ \| " replacement=""/>
</PatternLayout>
</File>
</Route>
<Route> <Route>
<!-- The default route sends the log to an on-demand file whose name contains the class and test names -->
<File <File
name="Test-${ctx:class}-${ctx:test}" name="Creates CLASSNAME.TESTNAME.log"
filename="build/acceptanceTestLogs/${ctx:class}.${ctx:test}.log" filename="build/acceptanceTestLogs/${ctx:class}.${ctx:test}.log"
append="false" append="false"
createOnDemand="true" createOnDemand="true"
@ -32,9 +49,21 @@
</Routing> </Routing>
<Routing name="PerTestSubprocessFile"> <Routing name="PerTestSubprocessFile">
<Routes pattern="${ctx:class}-${ctx:test}"> <Routes pattern="${ctx:class}-${ctx:test}">
<Route key="$${ctx:class}-$${ctx:test}">
<!-- The class and test names failed to resolve, so use a catch-all filename -->
<File
name="Appends to AllTestsMissingExtraLoggingConf.log"
filename="build/acceptanceTestLogs/AllTestsMissingExtraLoggingConf.log"
append="true"
createOnDemand="true"
>
<PatternLayout pattern="%X{node} | %msg%n" />
</File>
</Route>
<Route> <Route>
<!-- The default route sends the log to an on-demand file whose name contains the class and test names -->
<File <File
name="TestSubprocess-${ctx:class}-${ctx:test}" name="Appends to CLASSNAME.TESTNAME.log"
filename="build/acceptanceTestLogs/${ctx:class}.${ctx:test}.log" filename="build/acceptanceTestLogs/${ctx:class}.${ctx:test}.log"
append="true" append="true"
createOnDemand="true" createOnDemand="true"
@ -42,6 +71,7 @@
<PatternLayout pattern="%X{node} | %msg%n" /> <PatternLayout pattern="%X{node} | %msg%n" />
</File> </File>
</Route> </Route>
</Routes> </Routes>
</Routing> </Routing>

@ -233,6 +233,9 @@ allprojects {
* with the 'include' option above since it is a pattern, but this is a slightly more convenient * with the 'include' option above since it is a pattern, but this is a slightly more convenient
* option. * option.
* - 'root.log.level' and 'evm.log.level': allow to control the log level used during the tests. * - 'root.log.level' and 'evm.log.level': allow to control the log level used during the tests.
* - 'acctests.keepLogsOfPassingTests': log files of failed acceptance tests are always saved.
* This property additionally keeps the log files of successful tests.
*
*/ */
test { test {
jvmArgs = [ jvmArgs = [

Loading…
Cancel
Save