Skip to content

Commit

Permalink
Merge pull request #11607 from briancain/fixup/docker-install-test
Browse files Browse the repository at this point in the history
Fixes #11606: Mock out guest capabilities instead of running them
  • Loading branch information
briancain authored May 11, 2020
2 parents 7ffbf85 + 3934a26 commit 0556d21
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/unit/plugins/provisioners/docker/installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
end

it "installs docker if not present" do
expect(communicator).to receive(:test).with(/docker/, {:sudo=>true}).and_return(false).at_least(:twice)
# Will execute sudo commands to install
expect(communicator).to receive(:sudo).at_least(:once)
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_installed).and_return(true)
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_install).and_return(false)
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_installed).and_return(false)

# Expect to raise error since we are mocking out the test for docker install to return false
expect {subject.ensure_installed()}.to raise_error(VagrantPlugins::DockerProvisioner::DockerError)
end
Expand Down

0 comments on commit 0556d21

Please sign in to comment.