-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to trigger out-of-diskspace error.
- Loading branch information
Showing
10 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
config.json | ||
virtual_disks/ | ||
mount-small-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
## file: mount-small-cache.sh | ||
## brief: mounts an intentionally small directory for out-of-diskspace tests. | ||
## author: Preston Narchetti <[email protected]> | ||
|
||
if [ ${EUID} -ne 0 ]; then | ||
echo "Script must be run as root." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
## must match the path set in config.json.in. | ||
small_cache_path="@CMAKE_CURRENT_BINARY_DIR@/small_cache/" | ||
quota_size="1M" | ||
|
||
## used to check return code for each command. | ||
function check_err { | ||
rc=$? | ||
if [ $rc -ne 0 ]; then | ||
echo $1 | ||
exit $rc | ||
fi | ||
} | ||
|
||
echo "Creating mount point." | ||
rm -rf ./virtual_disks | ||
mkdir -p ./virtual_disks | ||
rm -rf ${small_cache_path} | ||
mkdir -p ${small_cache_path} | ||
check_err "Failed to mkdir ${small_cache_path}." | ||
|
||
echo "Creating tmpfs." | ||
touch ./virtual_disks/fs.ext4 | ||
dd if=/dev/zero of=./virtual_disks/fs.ext4 bs=${quota_size} count=1 | ||
check_err "Failed to make exf4 tmpfs: dd" | ||
mkfs.ext4 ./virtual_disks/fs.ext4 | ||
check_err "Failed to make exf4 tmpfs: mkfs.ext4" | ||
|
||
echo "Mounting tmpfs at ${small_cache_path}." | ||
mount -o loop,rw,usrquota,grpquota ./virtual_disks/fs.ext4 ${small_cache_path} | ||
check_err "Failed to mount exf4 tmpfs." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# tdnf-test-toolarge spec file | ||
# | ||
Summary: creates a fake random file that is too large for cache dir. | ||
Name: tdnf-test-toolarge | ||
Version: 1.0.1 | ||
Release: 1 | ||
Vendor: VMware, Inc. | ||
Distribution: Photon | ||
License: VMware | ||
Url: http://www.vmware.com | ||
Group: Applications/tdnftest | ||
|
||
%description | ||
Part of tdnf test spec. Creates a large file to intentionally trigger an | ||
out of disk space error. | ||
|
||
%prep | ||
|
||
%build | ||
|
||
%install | ||
mkdir -p %_topdir/%buildroot/lib/toolarge/ | ||
touch %_topdir/%buildroot/lib/toolarge/largedata.txt | ||
dd if=/dev/urandom of=%_topdir/%buildroot/lib/toolarge/largedata.txt bs=1M count=1 | ||
|
||
%files | ||
/lib/toolarge/largedata.txt | ||
|
||
%changelog | ||
- Initial build. First version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters