providers/docker: Add usability test
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
25e11650c3
commit
7980178d19
|
@ -11,6 +11,14 @@ module VagrantPlugins
|
|||
class Provider < Vagrant.plugin("2", :provider)
|
||||
@@host_vm_mutex = Mutex.new
|
||||
|
||||
def self.usable?(raise_error=false)
|
||||
Driver.new.execute("docker", "version")
|
||||
true
|
||||
rescue Vagrant::Errors::CommandUnavailable, Errors::ExecuteError
|
||||
raise if raise_error
|
||||
return false
|
||||
end
|
||||
|
||||
def initialize(machine)
|
||||
@logger = Log4r::Logger.new("vagrant::provider::docker")
|
||||
@machine = machine
|
||||
|
|
|
@ -28,6 +28,11 @@ shared_context "virtualbox" do
|
|||
allow(subprocess).to receive(:execute).
|
||||
with("VBoxManage", "showvminfo", kind_of(String), kind_of(Hash)).
|
||||
and_return(subprocess_result(exit_code: 0))
|
||||
|
||||
# apparently this is also used in docker tests
|
||||
allow(subprocess).to receive(:execute).
|
||||
with("docker", "version", an_instance_of(Hash)).
|
||||
and_return(subprocess_result(exit_code: 0))
|
||||
end
|
||||
|
||||
around do |example|
|
||||
|
|
Loading…
Reference in New Issue