Sha256: 2a4dcb32e323d7645b69a34c0dcbea90e644328528659a96ba5c46880d8d31c8

Contents?: true

Size: 1.45 KB

Versions: 59

Compression:

Stored size: 1.45 KB

Contents

require File.expand_path("../base", __FILE__)
require "acceptance/support/shared/command_examples"

describe "vagrant ssh" do
  include_context "acceptance"
  it_behaves_like "a command that requires a Vagrantfile", ["vagrant", "ssh"]
  it_behaves_like "a command that requires a virtual machine", ["vagrant", "ssh"]

  it "is able to SSH into a running virtual machine" do
    require_box("default")

    assert_execute("vagrant", "box", "add", "base", box_path("default"))
    assert_execute("vagrant", "init")
    assert_execute("vagrant", "up")

    outputted = false
    result = assert_execute("vagrant", "ssh") do |io_type, data|
      if io_type == :stdin and !outputted
        data.puts("echo hello")
        data.puts("exit")
        outputted = true
      end
    end

    result.stdout.chomp.should eql("hello"), "Vagrant should bring up a VM to be able to SSH into."
  end

  it "is able to execute a single command via the command line" do
    require_box("default")

    assert_execute("vagrant", "box", "add", "base", box_path("default"))
    assert_execute("vagrant", "init")
    assert_execute("vagrant", "up")

    result = execute("vagrant", "ssh", "-c", "echo foo")
    result.exit_code.should == 0
    result.stdout.should == "foo\n"

    result = execute("vagrant", "ssh", "-c", "foooooooooo")
    result.exit_code.should == 127
    result.stderr.should =~ /foooooooooo: command not found/
  end

  # TODO:
  # SSH should fail if the VM is not running
end

Version data entries

59 entries across 59 versions & 11 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/acceptance/ssh_test.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/acceptance/ssh_test.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/ssh_test.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/ssh_test.rb
bmhatfield-vagrant-1.0.10 test/acceptance/ssh_test.rb
bmhatfield-vagrant-1.0.9 test/acceptance/ssh_test.rb
tnargav-1.3.6 test/acceptance/ssh_test.rb
tnargav-1.3.3 test/acceptance/ssh_test.rb
bmhatfield-vagrant-1.0.8 test/acceptance/ssh_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/ssh_test.rb
tnargav-1.2.3 test/acceptance/ssh_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/ssh_test.rb
bmhatfield-vagrant-1.0.7 test/acceptance/ssh_test.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/ssh_test.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/ssh_test.rb
tnargav-1.2.2 test/acceptance/ssh_test.rb
vagrantup-1.1.3 test/acceptance/ssh_test.rb
vagrantup-1.1.2 test/acceptance/ssh_test.rb
vagrantup-1.1.1 test/acceptance/ssh_test.rb
vagrantup-1.1.0 test/acceptance/ssh_test.rb