Only build ARA report when test fails

In order to reduce the quantity of unnecessary log content
being kept in OpenStack-Infra we only generate the ARA report
when the test result is a failure. The ARA sqlite database is
still available for self generation if desired for successful
tests.

Change-Id: I3ab9752650911bba0b8be5e73b65019e97bfef42
This commit is contained in:
Jesse Pretorius 2017-10-13 11:01:18 +01:00
parent a0041826b3
commit ceee7c1be5
2 changed files with 15 additions and 1 deletions

View File

@ -97,6 +97,10 @@ function execute_ansible_playbook {
}
function gate_job_exit_tasks {
# This environment variable captures the exit code
# which was present when the trap was initiated.
# This would be the success/failure of the test.
export TEST_EXIT_CODE=$?
source "${COMMON_TESTS_PATH}/test-log-collect.sh"
}

View File

@ -83,7 +83,17 @@ if [[ -d "/etc/nodepool" ]]; then
${RSYNC_CMD} "${TESTING_HOME}/.ara/ansible.sqlite" "${WORKING_DIR}/logs/" || true
# Generate the ARA report
${ARA_CMD} "${WORKING_DIR}/logs/ara" || true
# In order to reduce the quantity of unnecessary log content
# being kept in OpenStack-Infra we only generate the ARA report
# when the test result is a failure. The ARA sqlite database is
# still available for self generation if desired for successful
# tests.
if [[ "${TEST_EXIT_CODE}" != "0" ]]; then
echo "Generating ARA report due to non-zero exit code (${TEST_EXIT_CODE})."
${ARA_CMD} "${WORKING_DIR}/logs/ara" || true
else
echo "Not generating ARA report due to test pass."
fi
# Get a dmesg output so we can look for kernel failures
dmesg > "${WORKING_DIR}/logs/dmesg.log.txt" || true