From fba9f7c473e8561fddc4c820bf2c17fb92f25ab7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 22 Nov 2011 21:47:10 -0800 Subject: [PATCH] Test that a VM can be brought back up after halting --- test/acceptance/halt_test.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/test/acceptance/halt_test.rb b/test/acceptance/halt_test.rb index 876d1586c..0604767ea 100644 --- a/test/acceptance/halt_test.rb +++ b/test/acceptance/halt_test.rb @@ -26,7 +26,7 @@ describe "vagrant halt" do result = assert_execute("vagrant", "halt") result.stdout.should match_output(:vm_halt_graceful) - # Assert that the VM no longer is created + # Assert that the VM is no longer running result = assert_execute("vagrant", "status") result.stdout.should match_output(:status, "default", "powered off") end @@ -42,13 +42,31 @@ describe "vagrant halt" do result = assert_execute("vagrant", "halt", "--force") result.stdout.should match_output(:vm_halt_force) - # Assert that the VM no longer is created + # Assert that the VM is no longer running result = assert_execute("vagrant", "status") result.stdout.should match_output(:status, "default", "powered off") end + it "is able to come back up after the machine has been halted" do + require_box("default") + + assert_execute("vagrant", "box", "add", "base", box_path("default")) + assert_execute("vagrant", "init") + assert_execute("vagrant", "up") + assert_execute("vagrant", "halt") + + # Assert that the VM is no longer running + result = assert_execute("vagrant", "status") + result.stdout.should match_output(:status, "default", "powered off") + + assert_execute("vagrant", "up") + + # Assert that the VM is once again running + result = assert_execute("vagrant", "status") + result.stdout.should match_output(:status, "default", "running") + end + # TODO: # halt behavior on suspend machine # halt behavior if machine is already powered off - # VM can come back up after a halt end