tests: Improve handling of log file during teardown

This commit is contained in:
Jerome Charaoui 2020-12-30 23:29:24 -05:00
parent 6f5411db03
commit 54fd9f10b8

View File

@ -44,8 +44,14 @@ EOF
teardown() {
# Print the debug log in case the test case fails
echo "cat ${BATS_TMPDIR}/log/backupninja.log :"
cat "${BATS_TMPDIR}/log/backupninja.log"
if [ -f "${BATS_TMPDIR}/log/backupninja.log" ]; then
echo "cat ${BATS_TMPDIR}/log/backupninja.log :"
cat "${BATS_TMPDIR}/log/backupninja.log"
# Copy logfile so it can be examined in subsequent tests
cp "${BATS_TMPDIR}/log/backupninja.log" "${BATS_TMPDIR}/_backupninja.log"
else
echo "backupninja.log not found"
fi
# Clean up
rm -rf "${BATS_TMPDIR}/backupninja.conf" \