Add more SSH tests

This commit is contained in:
Mitchell Hashimoto 2011-11-06 22:21:02 -08:00
parent 3412a11c51
commit 2796c441ea
2 changed files with 23 additions and 1 deletions

View File

@ -44,5 +44,11 @@ module Acceptance
def status(vm_name, status)
@text =~ /^#{vm_name}\s+#{status}$/
end
# This checks that an error message that the VM must be created
# is shown.
def error_vm_must_be_created
@text =~ /^VM must be created/
end
end
end

View File

@ -1,7 +1,23 @@
require File.expand_path("../base", __FILE__)
class SSHTest < AcceptanceTest
should "bring up a running virtual machine and be able to SSH into it" do
should "fail if no Vagrantfile is found" do
result = execute("vagrant", "ssh")
assert(!result.success?, "vagrant ssh should fail")
assert(output(result.stdout).no_vagrantfile,
"Vagrant should error since there is no Vagrantfile")
end
should "fail if the virtual machine is not created" do
assert_execute("vagrant", "init")
result = execute("vagrant", "ssh")
assert(!result.success?, "vagrant ssh should fail")
assert(output(result.stdout).error_vm_must_be_created,
"Vagrant should error that the VM must be created.")
end
should "be able to SSH into a running virtual machine" do
assert_execute("vagrant", "box", "add", "base", config.boxes["default"])
assert_execute("vagrant", "init")
assert_execute("vagrant", "up")