repo: Add OSTREE_REPO_TEST_ERROR=pre-commit env var

Setting this causes commit to error out.  There are other ways we
could do this in a more sophisticated fashion, such as via SystemTap
etc.  But this has low-tech applicablity, works as non-root.

The reason I'm adding this is so that we can add test cases for
cleanup of the `tmp/staging-` directory.

Closes: #170
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Colin Walters (automation) committed 2016-05-02 18:44:44 +00:00
1 parent 3111248373
commit 15b3cab65e
4 files changed
+29 -1

No files matched your search

+10 -1
View File
@@ -19,7 +19,7 @@
set -euo pipefail
echo "1..53"
echo "1..54"
$OSTREE checkout test2 checkout-test2
echo "ok checkout"
@@ -397,6 +397,15 @@ assert_file_has_content test2-checkout/baz/cow moo
assert_has_dir repo2/uncompressed-objects-cache
echo "ok disable cache checkout"
cd ${test_tmpdir}
rm checkout-test2 -rf
$OSTREE checkout test2 checkout-test2
if env OSTREE_REPO_TEST_ERROR=pre-commit $OSTREE commit -b test2 -s '' $test_tmpdir/checkout-test2 2>err.txt; then
assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT"
fi
assert_file_has_content err.txt OSTREE_REPO_TEST_ERROR_PRE_COMMIT
echo "ok test error pre commit"
# Whiteouts
cd ${test_tmpdir}
mkdir -p overlay/baz/