ostree/tests/installed/itest-pull-space.sh
Colin Walters bb9cd1eb72 tests/installed: Use temporary directories more consistently
This is prep for splitting off "nondestructive" tests which
we can run in parallel from the destructive/invasive ones which
e.g. change the host refspec, do deployments.

The `cd` invocation in `prepare_tmpdir` wasn't working because we were running
it in a subshell. Fix this by dropping the subshell.

Closes: #1509
Approved by: jlebon
2018-03-22 19:01:52 +00:00

25 lines
592 B
Bash
Executable File

#!/bin/bash
# Test min-free-space-percent using loopback devices
set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/libinsttest.sh
prepare_tmpdir
trap _tmpdir_cleanup EXIT
cd ${test_tmpdir}
truncate -s 100MB testblk.img
blkdev=$(losetup --find --show $(pwd)/testblk.img)
mkfs.xfs ${blkdev}
mkdir mnt
mount ${blkdev} mnt
ostree --repo=mnt/repo init --mode=bare-user
if ostree --repo=mnt/repo pull-local /ostree/repo ${host_commit} 2>err.txt; then
fatal "succeeded in doing a pull with no free space"
fi
assert_file_has_content err.txt "min-free-space-percent"
umount mnt
losetup -d ${blkdev}