ostree/tests/installed/itest-pull-space.sh
Colin Walters 1f5ce1a9f7 lib/repo: Add min-free-space-percent option, default 3%
For ostree-as-host, we're the superuser, so we'll blow past
any reserved free space by default.  While deltas have size
metadata, if one happens to do a loose fetch, we can fill
up the disk.

Another case is flatpak: the system helper has similar concerns
here as ostree-as-host, and for `flatpak --user`, we also
want to be nice and avoid filling up the user's quota.

Closes: https://github.com/ostreedev/ostree/issues/962

Closes: #987
Approved by: jlebon
2017-07-04 16:15:11 +00:00

25 lines
607 B
Bash
Executable File

#!/bin/bash
# Test min-free-space-percent using loopback devices
set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/libinsttest.sh
test_tmpdir=$(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}