Sha256: 38e47ec5ac553977dc0c6690182f1dc1cb4d567050c7781c915dfc0a1b708be5

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

require_relative "../../../../base"

describe "VagrantPlugins::GuestSolaris11::Cap::Halt" do
  let(:caps) do
    VagrantPlugins::GuestSolaris11::Plugin
      .components
      .guest_capabilities[:solaris11]
  end

  let(:shutdown_command){ "sudo /usr/sbin/shutdown -y -i5 -g0" }
  let(:machine) { double("machine", config: double("config", solaris11: double("solaris11", suexec_cmd: 'sudo'))) }
  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(shutdown_command)
      cap.halt(machine)
    end

    it "ignores an IOError" do
      comm.stub_command(shutdown_command, raise: IOError)
      expect {
        cap.halt(machine)
      }.to_not raise_error
    end

    it "ignores a Vagrant::Errors::SSHDisconnected" do
      comm.stub_command(shutdown_command, raise: Vagrant::Errors::SSHDisconnected)
      expect {
        cap.halt(machine)
      }.to_not raise_error
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-unbundled-2.0.0.1 test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-unbundled-1.9.8.1 test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-unbundled-1.9.7.1 test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-unbundled-1.9.5.1 test/unit/plugins/guests/solaris11/cap/halt_test.rb
vagrant-unbundled-1.9.1.1 test/unit/plugins/guests/solaris11/cap/halt_test.rb