cask install: increase APFS test sleep to avoid slow eject fail

This commit is contained in:
Michael Cho 2021-03-29 23:17:21 -07:00
parent cf8d96e0b2
commit 1a398f9aaf
2 changed files with 26 additions and 26 deletions

View File

@ -16,28 +16,32 @@ describe Cask::Installer, :cask do
expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory
end end
[ it "works with HFS+ dmg-based Casks" do
["HFS+", "container-dmg"], asset = Cask::CaskLoader.load(cask_path("container-dmg"))
["APFS", "container-apfs-dmg"],
].each do |filesystem, cask| described_class.new(asset).install
it "works with #{filesystem} dmg-based Casks" do
asset = Cask::CaskLoader.load(cask_path(cask)) expect(Cask::Caskroom.path.join("container-dmg", asset.version)).to be_a_directory
expect(asset.config.appdir.join("container")).to be_a_file
end
it "works with APFS dmg-based Casks" do
asset = Cask::CaskLoader.load(cask_path("container-apfs-dmg"))
diskutil_list_command = "diskutil list | grep '/dev'" diskutil_list_command = "diskutil list | grep '/dev'"
sleep(1) sleep 5
original_diskutil_list = `#{diskutil_list_command}` original_diskutil_list = `#{diskutil_list_command}`
described_class.new(asset).install described_class.new(asset).install
expect(Cask::Caskroom.path.join(cask, asset.version)).to be_a_directory expect(Cask::Caskroom.path.join("container-apfs-dmg", asset.version)).to be_a_directory
expect(asset.config.appdir.join("container")).to be_a_file expect(asset.config.appdir.join("container")).to be_a_file
sleep(2) sleep 5
expect { system diskutil_list_command } expect { system diskutil_list_command }
.to output(original_diskutil_list) .to output(original_diskutil_list)
.to_stdout_from_any_process .to_stdout_from_any_process
end end
end
it "works with tar-gz-based Casks" do it "works with tar-gz-based Casks" do
asset = Cask::CaskLoader.load(cask_path("container-tar-gz")) asset = Cask::CaskLoader.load(cask_path("container-tar-gz"))

View File

@ -96,15 +96,11 @@ module UnpackStrategy
# For HFS, just use <mount-path> # For HFS, just use <mount-path>
# For APFS, find the <physical-store> corresponding to <mount-path> # For APFS, find the <physical-store> corresponding to <mount-path>
eject_paths = if disk_info.success? eject_paths = disk_info.plist
disk_info.plist
.fetch("APFSPhysicalStores", []) .fetch("APFSPhysicalStores", [])
.map { |store| store["APFSPhysicalStore"] } .map { |store| store["APFSPhysicalStore"] }
.compact .compact
.presence || [path] .presence || [path]
else
[path]
end
eject_paths.each do |eject_path| eject_paths.each do |eject_path|
system_command! "diskutil", system_command! "diskutil",