diff --git a/lib/vagrant/action/vm/boot.rb b/lib/vagrant/action/vm/boot.rb index 861a86d6a..97d089312 100644 --- a/lib/vagrant/action/vm/boot.rb +++ b/lib/vagrant/action/vm/boot.rb @@ -26,7 +26,7 @@ module Vagrant @env["vm"].vm.start(@env.env.config.vm.boot_mode) end - def wait_for_boot(sleeptime=5) + def wait_for_boot @env.logger.info "Waiting for VM to boot..." @env.env.config.ssh.max_tries.to_i.times do |i| @@ -41,7 +41,7 @@ module Vagrant # get shown return true if @env.interrupted? - sleep sleeptime + sleep 5 if !@env["vagrant.test"] end @env.logger.info "Failed to connect to VM! Failed to boot?" diff --git a/lib/vagrant/action/vm/halt.rb b/lib/vagrant/action/vm/halt.rb index 23b6d65c3..1f57683ab 100644 --- a/lib/vagrant/action/vm/halt.rb +++ b/lib/vagrant/action/vm/halt.rb @@ -23,7 +23,7 @@ module Vagrant # Sleep for a second to verify that the VM properly # cleans itself up - sleep 1 + sleep 1 if !env["vagrant.test"] end @app.call(env) diff --git a/test/test_helper.rb b/test/test_helper.rb index be3c77137..68fad5d08 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -93,6 +93,7 @@ class Test::Unit::TestCase def mock_action_data app = lambda { |env| } env = Vagrant::Action::Environment.new(mock_environment) + env["vagrant.test"] = true [app, env] end diff --git a/test/vagrant/action/env/set_test.rb b/test/vagrant/action/env/set_test.rb index 2cae0717f..4beaa07b7 100644 --- a/test/vagrant/action/env/set_test.rb +++ b/test/vagrant/action/env/set_test.rb @@ -4,6 +4,7 @@ class SetEnvActionTest < Test::Unit::TestCase setup do @klass = Vagrant::Action::Env::Set @app, @env = mock_action_data + @env.clear end should "merge in the given options" do diff --git a/test/vagrant/action/vm/boot_test.rb b/test/vagrant/action/vm/boot_test.rb index aaf935a18..ebfd87b5f 100644 --- a/test/vagrant/action/vm/boot_test.rb +++ b/test/vagrant/action/vm/boot_test.rb @@ -66,18 +66,18 @@ class BootVMActionTest < Test::Unit::TestCase seq = sequence('pings') @vm.ssh.expects(:up?).times(@env.env.config.ssh.max_tries.to_i - 1).returns(false).in_sequence(seq) @vm.ssh.expects(:up?).once.returns(true).in_sequence(seq) - assert @instance.wait_for_boot(0) + assert @instance.wait_for_boot end should "return right away if interrupted" do @env.error!(:interrupt) @vm.ssh.expects(:up?).times(1).returns(false) - assert @instance.wait_for_boot(0) + assert @instance.wait_for_boot end should "ping the max number of times then just return" do @vm.ssh.expects(:up?).times(@env.env.config.ssh.max_tries.to_i).returns(false) - assert !@instance.wait_for_boot(0) + assert !@instance.wait_for_boot end end end