summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-12-09 13:35:30 +0100
committeranonym <anonym@riseup.net>2016-12-09 13:35:30 +0100
commit640ddb2cbc67206f56f3c869b9de1377c6fecb28 (patch)
treed1ab09991427273b8fcd14491f316580c5a42c21
parent517145452c7bc1037a59e56eb7d63632b79cb0c1 (diff)
Make share_host_files() disk size adaptable.
So it won't require creating an unnecessarily large disk, and so it can share files that in total occupy more than 2 GiB of disk space.
-rw-r--r--features/step_definitions/common_steps.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb
index a335d0a..2decb7a 100644
--- a/features/step_definitions/common_steps.rb
+++ b/features/step_definitions/common_steps.rb
@@ -964,8 +964,11 @@ end
def share_host_files(files)
files = [files] if files.class == String
assert_equal(Array, files.class)
+ disk_size = files.map { |f| File.new(f).size } .inject(0, :+)
+ # Let's add an extra MiB for filesysten overhead etc.
+ disk_size += convert_to_bytes(1, 'MiB')
disk = random_alpha_string(10)
- step "I temporarily create an 2 GiB disk named \"#{disk}\""
+ step "I temporarily create an #{disk_size} bytes disk named \"#{disk}\""
step "I create a gpt partition labeled \"#{disk}\" with an ext4 " +
"filesystem on disk \"#{disk}\""
$vm.storage.guestfs_disk_helper(disk) do |g, _|