mount_vmware_shared_folder_test.rb (vagrant-2.2.13) | : | mount_vmware_shared_folder_test.rb (vagrant-2.2.14) | ||
---|---|---|---|---|
require_relative "../../../../base" | require_relative "../../../../base" | |||
describe "VagrantPlugins::GuestDarwin::Cap::MountVmwareSharedFolder" do | describe "VagrantPlugins::GuestDarwin::Cap::MountVmwareSharedFolder" do | |||
let(:described_class) do | let(:described_class) do | |||
VagrantPlugins::GuestDarwin::Plugin | VagrantPlugins::GuestDarwin::Plugin | |||
.components | .components | |||
.guest_capabilities[:darwin] | .guest_capabilities[:darwin] | |||
.get(:mount_vmware_shared_folder) | .get(:mount_vmware_shared_folder) | |||
end | end | |||
let(:machine) { double("machine", communicate: communicator, id: "MACHINE_ID") | let(:machine) { double("machine", communicate: communicator, id: "MACHINE_ID", | |||
} | guest: guest) } | |||
let(:guest) {double("guest")} | ||||
let(:communicator) { double("communicator") } | let(:communicator) { double("communicator") } | |||
before do | before do | |||
allow(communicator).to receive(:test) | allow(communicator).to receive(:test) | |||
allow(communicator).to receive(:sudo) | allow(communicator).to receive(:sudo) | |||
allow(VagrantPlugins::GuestDarwin::Plugin).to receive(:action_hook) | allow(VagrantPlugins::GuestDarwin::Plugin).to receive(:action_hook) | |||
end | end | |||
describe ".mount_vmware_shared_folder" do | describe ".mount_vmware_shared_folder" do | |||
let(:name) { "-vagrant" } | let(:name) { "-vagrant" } | |||
let(:guestpath) { "/vagrant" } | let(:guestpath) { "/vagrant" } | |||
let(:options) { {} } | let(:options) { {} } | |||
before do | before do | |||
allow(described_class).to receive(:system_firmlink?) | allow(described_class).to receive(:system_firmlink?) | |||
described_class.reset! | described_class.reset! | |||
end | end | |||
after { described_class. | after { | |||
mount_vmware_shared_folder(machine, name, guestpath, options) } | described_class.mount_vmware_shared_folder(machine, name, guestpath, optio | |||
ns) | ||||
} | ||||
context "with APFS root container" do | context "with APFS root container" do | |||
before do | before do | |||
expect(communicator).to receive(:test).with("test -d /System/Volumes/Dat a").and_return(true) | expect(communicator).to receive(:test).with("test -d /System/Volumes/Dat a").and_return(true) | |||
end | end | |||
it "should check for existing entry" do | it "should check for existing entry" do | |||
expect(communicator).to receive(:test).with(/synthetic\.conf/) | expect(communicator).to receive(:test).with(/synthetic\.conf/) | |||
end | end | |||
skipping to change at line 76 | skipping to change at line 78 | |||
end | end | |||
it "should create the symlink to the vmware folder" do | it "should create the symlink to the vmware folder" do | |||
expect(communicator).to receive(:sudo).with(/ln -s/) | expect(communicator).to receive(:sudo).with(/ln -s/) | |||
end | end | |||
it "should create the symlink within the writable APFS container" do | it "should create the symlink within the writable APFS container" do | |||
expect(communicator).to receive(:sudo).with(%r{ln -s .+/System/Volumes /Data.+}) | expect(communicator).to receive(:sudo).with(%r{ln -s .+/System/Volumes /Data.+}) | |||
end | end | |||
{ | ||||
19 => "-B", | ||||
20 => "-t", | ||||
21 => "-t", | ||||
nil => "-B" | ||||
}.each do |version, expected_flag| | ||||
it "should re-bootstrap root dir for darwin version #{version}" do | ||||
expect(communicator).to receive(:sudo).with(/apfs.util #{expected_fl | ||||
ag}/, any_args) | ||||
expect(guest).to receive(:capability).with("darwin_major_version").a | ||||
nd_return(version) | ||||
described_class.mount_vmware_shared_folder(machine, name, guestpath, | ||||
options) | ||||
described_class.apfs_firmlinks_delayed[machine.id].call | ||||
end | ||||
end | ||||
context "when firmlink is provided by the system" do | context "when firmlink is provided by the system" do | |||
before { expect(described_class).to receive(:system_firmlink?).and_ret urn(true) } | before { expect(described_class).to receive(:system_firmlink?).and_ret urn(true) } | |||
it "should not register an action hook" do | it "should not register an action hook" do | |||
expect(VagrantPlugins::GuestDarwin::Plugin).not_to receive(:action_h ook).with(:apfs_firmlinks, :after_synced_folders) | expect(VagrantPlugins::GuestDarwin::Plugin).not_to receive(:action_h ook).with(:apfs_firmlinks, :after_synced_folders) | |||
end | end | |||
end | end | |||
end | end | |||
end | end | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 25 lines changed or added |