For OpenBSD versions prior to 5.7 the `-h` option _must_ be provided to the `shutdown` command when `-p` is used. Later versions no longer require the `-h` option but still allow it for compatibility. http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.8?rev=1.40&content-type=text/x-cvsweb-markup http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.c?rev=1.40&content-type=text/x-cvsweb-markup
44 lines
1.0 KiB
Ruby
44 lines
1.0 KiB
Ruby
require_relative "../../../../base"
|
|
|
|
describe "VagrantPlugins::GuestOpenBSD::Cap::Halt" do
|
|
let(:caps) do
|
|
VagrantPlugins::GuestOpenBSD::Plugin
|
|
.components
|
|
.guest_capabilities[:openbsd]
|
|
end
|
|
|
|
let(:machine) { double("machine") }
|
|
let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
|
|
|
before do
|
|
allow(machine).to receive(:communicate).and_return(comm)
|
|
end
|
|
|
|
after do
|
|
comm.verify_expectations!
|
|
end
|
|
|
|
describe ".halt" do
|
|
let(:cap) { caps.get(:halt) }
|
|
|
|
it "runs the shutdown command" do
|
|
comm.expect_command("/sbin/shutdown -p -h now")
|
|
cap.halt(machine)
|
|
end
|
|
|
|
it "ignores an IOError" do
|
|
comm.stub_command("/sbin/shutdown -p -h now", raise: IOError)
|
|
expect {
|
|
cap.halt(machine)
|
|
}.to_not raise_error
|
|
end
|
|
|
|
it "ignores an Vagrant::Errors::SSHDisconnected" do
|
|
comm.stub_command("/sbin/shutdown -p -h now", raise: Vagrant::Errors::SSHDisconnected)
|
|
expect {
|
|
cap.halt(machine)
|
|
}.to_not raise_error
|
|
end
|
|
end
|
|
end
|