From 823a0f2817ed9afd1e5c298da90357059a5a8dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horacio=20Mijail=20Ant=C3=B3n=20Quiles?= <4139546+hmijail@users.noreply.github.com> Date: Fri, 1 May 2020 08:24:20 +1000 Subject: [PATCH] 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 Co-authored-by: Sally MacFarlane --- .circleci/config.yml | 8 +++++ .../tests/src/test/resources/log4j2.xml | 34 +++++++++++++++++-- build.gradle | 3 ++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e449349d22..d5e63b5fb1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,6 +56,13 @@ commands: - store_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: assemble: executor: besu_executor_xl @@ -152,6 +159,7 @@ jobs: GRADLE_ARGS=$(echo $CLASSNAMES | awk '{for (i=1; i<=NF; i++) print "--tests",$i}') ./gradlew --no-daemon acceptanceTest $GRADLE_ARGS - capture_test_results + - capture_test_logs buildDocker: executor: besu_executor_med diff --git a/acceptance-tests/tests/src/test/resources/log4j2.xml b/acceptance-tests/tests/src/test/resources/log4j2.xml index 453f92f20a..9f940a23f9 100644 --- a/acceptance-tests/tests/src/test/resources/log4j2.xml +++ b/acceptance-tests/tests/src/test/resources/log4j2.xml @@ -3,6 +3,7 @@ INFO + @@ -13,11 +14,27 @@ + + + + + + %X{node} | %d{HH:mm:ss.SSS} | %t | %-5level | %c{1} | %msg%n + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index 8348db25fe..d77df46b38 100644 --- a/build.gradle +++ b/build.gradle @@ -233,6 +233,9 @@ allprojects { * with the 'include' option above since it is a pattern, but this is a slightly more convenient * option. * - '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 { jvmArgs = [