Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is some test cases for: https://bugzilla.redhat.com/show_bug.cgi?id=1703278 which provides some failing tests for when `validate_free_space` checks the wrong directory, and helps validate that the fix here: ManageIQ/manageiq#18745 Does what it is supposed to. Thanks a bunch to Dan Berger for the assist on this and pointing me in the direction to use loop back devices. Turned out to be a much better solution then what I was considering with vagrant directly. How it works ------------ This patch effectively does three things: First, it adds a provision step on VM boot to add a loop back device (or a file that acts like a file system) to represent a "fake tmp" directory that is under 2MB in size after file system overhead. The process for building this can be found in the "mount_fake_tmp" provision step, but the file is writable to just like a normal mountable file system, and since it is so small it won't fit even our ~2MB database dumps. Of note, something that was require was the `chmod +t`, which adds the sticky bit on to the dir. This is essential for the next part which... Secondly, adds a patch to `tmpdir` which forces `Dir.tmpdir` to return `/fake_tmp` instead of `/tmp`. This part we override both the `@@systmpdir` var and the `ENV['TMPDIR']` values since either one could be used in determining the `Dir.tmpdir` depending on the value of `$SAFE`. Since usually we aren't using `@@systmpdir`, the `chmod +t ...` becomes important here since it allows the `File::Stat#sticky?` check to pass, allowing `/fake_tmp` dir to be a vaild option, and not fall back to `/tmp` instead. Finally, we inject the patch into some tests to make sure that those tests still function when the "tmp" directory has a file that is smaller then the resulting dump/backup. These new tests fail without the patch from above, and pass with it. (transferred from https://gist.github.com/NickLaMuro/8438015363d90a2d2456be650a2b9bc6/bf256dd6a2f385a78cf945e4efea5084f63812e1)
- Loading branch information