From 703c1f153b8cf082b8ed91673bb910b8f19dbcd1 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Sun, 30 Nov 2014 22:00:06 -0600 Subject: [PATCH] providers/virtualbox: fix flaky test when rsync is not installed test-only change when rsync is not installed on the machine running the unit tests, the prepare_nfs_settings tests end up calling the :nfs_installed capability on the host, which fails on the fake host wired up in tests. this adds some explicit stubbing to prevent the implicit assumption that rsync is installed. --- .../virtualbox/action/prepare_nfs_settings_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb index dfef293ec..3cead74f4 100644 --- a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +++ b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb @@ -22,14 +22,21 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do let(:env) {{ machine: machine }} let(:app) { lambda { |*args| }} let(:driver) { double("driver") } + let(:host) { double("host") } subject { described_class.new(app, env) } before do env[:test] = true + allow(machine.env).to receive(:host) { host } + allow(host).to receive(:capability).with(:nfs_installed) { true } end it "calls the next action in the chain" do + driver.stub(read_network_interfaces: {2 => {type: :hostonly, hostonly: "vmnet2"}}) + driver.stub(read_host_only_interfaces: [{name: "vmnet2", ip: "1.2.3.4"}]) + allow(driver).to receive(:read_guest_ip).with(1).and_return("2.3.4.5") + called = false app = lambda { |*args| called = true }