Merge pull request #11936 from hpaskalev/feature/improved_vbox_installation_check

Detection of availability of VirtualBox provider #11929
This commit is contained in:
Chris Roberts 2020-11-03 13:54:11 -08:00 committed by GitHub
commit 311429d1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -23,7 +23,8 @@ module VagrantPlugins
rescue Vagrant::Errors::VirtualBoxInvalidVersion,
Vagrant::Errors::VirtualBoxNotDetected,
Vagrant::Errors::VirtualBoxKernelModuleNotLoaded,
Vagrant::Errors::VirtualBoxInstallIncomplete
Vagrant::Errors::VirtualBoxInstallIncomplete,
Vagrant::Errors::VBoxManageNotFoundError
raise if raise_error
return false
end

View File

@ -63,6 +63,14 @@ describe VagrantPlugins::ProviderVirtualBox::Provider do
expect { subject.usable?(true) }.
to raise_error(Vagrant::Errors::VirtualBoxInstallIncomplete)
end
it "raises an exception if VBoxManage is not found" do
allow(VagrantPlugins::ProviderVirtualBox::Driver::Meta).to receive(:new).
and_raise(Vagrant::Errors::VBoxManageNotFoundError)
expect { subject.usable?(true) }.
to raise_error(Vagrant::Errors::VBoxManageNotFoundError)
end
end
describe "#driver" do