Test shared folders for basic up tests

This commit is contained in:
Mitchell Hashimoto 2011-11-11 00:10:42 -08:00
parent 7a07a78bf1
commit f0aa19f696
3 changed files with 25 additions and 4 deletions

View File

@ -31,4 +31,7 @@ describe "vagrant ssh" do
result = assert_execute("vagrant", "ssh", "-c", "echo foo")
result.stdout.should == "foo\n"
end
# TODO:
# SSH should fail if the VM is not running
end

View File

@ -30,6 +30,4 @@ shared_examples "a command that requires a virtual machine" do |*args|
result.should_not be_success
result.stdout.should match_output(:error_vm_must_be_created)
end
# TODO: Check for specific VM states: running, stopped, etc.
end

View File

@ -5,20 +5,40 @@ describe "vagrant up", "basics" do
include_context "acceptance"
it_behaves_like "a command that requires a Vagrantfile", ["vagrant", "up"]
it "brings up a running virtual machine" do
# This creates an initial environment that is ready for a "vagrant up"
def initialize_valid_environment
assert_execute("vagrant", "box", "add", "base", config.boxes["default"])
assert_execute("vagrant", "init")
end
it "brings up a running virtual machine" do
initialize_valid_environment
assert_execute("vagrant", "up")
result = assert_execute("vagrant", "status")
result.stdout.should match_output(:status, "default", "running")
end
it "should have a '/vagrant' shared folder" do
initialize_valid_environment
# This is the file that will be created from the VM,
# but should then exist on the host machine
foofile = environment.workdir.join("foo")
assert_execute("vagrant", "up")
foofile.exist?.should_not be,
"'foo' should not exist yet."
assert_execute("vagrant", "ssh", "-c", "touch /vagrant/foo")
foofile.exist?.should be, "'foo' should exist since it was touched in the shared folder"
end
=begin
TODO:
should "be able to run if `Vagrantfile` is in parent directory"
should "bring up a running virtual machine and have a `/vagrant' shared folder by default"
should "destroy a running virtual machine"
should "save then restore a virtual machine using `vagrant up`"
should "halt then start a virtual machine using `vagrant up`"