This commit adds/changes the following for SmartOS guests: - modifies the "Halt" capability to use /usr/sbin/poweroff in preference to /usr/sbin/shutdown with parameters, and modifies the associated test. - adds an "InsertPublicKey" capability and tests. - adds a "RemovePublicKey" capability and tests. With this commit applied, the vast majority of typical Vagrant workflow is available to SmartOS global zone guests (provided NFS mounts are used rather than VMWare shared folders).
40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
require_relative "../../../../base"
|
|
|
|
describe "VagrantPlugins::GuestSmartos::Cap::Halt" do
|
|
let(:plugin) { VagrantPlugins::GuestSmartos::Plugin.components.guest_capabilities[:smartos].get(:halt) }
|
|
let(:machine) { double("machine") }
|
|
let(:config) { double("config", smartos: double("smartos", suexec_cmd: 'pfexec')) }
|
|
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
|
let(:shutdown_command){ "pfexec /usr/sbin/poweroff" }
|
|
|
|
before do
|
|
machine.stub(:communicate).and_return(communicator)
|
|
machine.stub(:config).and_return(config)
|
|
end
|
|
|
|
after do
|
|
communicator.verify_expectations!
|
|
end
|
|
|
|
describe ".halt" do
|
|
it "sends a shutdown signal" do
|
|
communicator.expect_command(shutdown_command)
|
|
plugin.halt(machine)
|
|
end
|
|
|
|
it "ignores an IOError" do
|
|
communicator.stub_command(shutdown_command, raise: IOError)
|
|
expect {
|
|
plugin.halt(machine)
|
|
}.to_not raise_error
|
|
end
|
|
|
|
it "ignores a Vagrant::Errors::SSHDisconnected" do
|
|
communicator.stub_command(shutdown_command, raise: Vagrant::Errors::SSHDisconnected)
|
|
expect {
|
|
plugin.halt(machine)
|
|
}.to_not raise_error
|
|
end
|
|
end
|
|
end
|