hack: fail tests if there are leftover temp files before or after

Upstream-commit: 5cd7de5de8fddd5868c6b85ed1e4f46228c82672
Component: engine
This commit is contained in:
Solomon Hykes
2013-10-18 03:31:21 +00:00
parent 1f33220276
commit 4e4f3e50fd
+22
View File
@@ -31,4 +31,26 @@ find_test_dirs() {
sort -u
}
check_test_garbage() {
nGarbage=`find /tmp/ -name 'docker-*' | wc -l`
if [ $nGarbage -gt 0 ]; then
(
cat <<EOF
Error: there are $nGarbage docker-related files in /tmp. Please clean them up and try again.
--------------------------------------------------------------------------------------------
EOF
find /tmp -name 'docker-*'
cat <<EOF
--------------------------------------------------------------------------------------------
If the error persists, your tests might leak temporary files. This is considered a test fail.
EOF
exit 1
) 2>&1
fi
}
check_test_garbage
bundle_test
check_test_garbage