vagrant-reload works
This commit is contained in:
parent
e8e07d26f5
commit
e855ae9965
|
@ -1,6 +1,14 @@
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Actions
|
module Actions
|
||||||
class Reload < Base
|
class Reload < Base
|
||||||
|
def prepare
|
||||||
|
steps = [Stop, ForwardPorts, SharedFolders, Start]
|
||||||
|
steps << Provision if Vagrant.config.chef.enabled
|
||||||
|
|
||||||
|
steps.each do |action_klass|
|
||||||
|
@vm.add_action(action_klass)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -63,8 +63,7 @@ error
|
||||||
def reload
|
def reload
|
||||||
Env.load!
|
Env.load!
|
||||||
Env.require_persisted_vm
|
Env.require_persisted_vm
|
||||||
|
Env.persisted_vm.execute!(Actions::Reload)
|
||||||
VM.execute!(Actions::Reload)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# SSH into the vagrant instance. This will setup an SSH connection into
|
# SSH into the vagrant instance. This will setup an SSH connection into
|
||||||
|
|
|
@ -3,5 +3,34 @@ require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
||||||
class ReloadActionTest < Test::Unit::TestCase
|
class ReloadActionTest < Test::Unit::TestCase
|
||||||
setup do
|
setup do
|
||||||
@mock_vm, @vm, @action = mock_action(Vagrant::Actions::Reload)
|
@mock_vm, @vm, @action = mock_action(Vagrant::Actions::Reload)
|
||||||
|
mock_config
|
||||||
|
end
|
||||||
|
|
||||||
|
context "sub-actions" do
|
||||||
|
setup do
|
||||||
|
@default_order = [Vagrant::Actions::Stop, Vagrant::Actions::ForwardPorts, Vagrant::Actions::SharedFolders, Vagrant::Actions::Start]
|
||||||
|
end
|
||||||
|
|
||||||
|
def setup_action_expectations
|
||||||
|
default_seq = sequence("default_seq")
|
||||||
|
@default_order.each do |action|
|
||||||
|
@mock_vm.expects(:add_action).with(action).once.in_sequence(default_seq)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "do the proper actions by default" do
|
||||||
|
setup_action_expectations
|
||||||
|
@action.prepare
|
||||||
|
end
|
||||||
|
|
||||||
|
should "add in the provisioning step if enabled" do
|
||||||
|
mock_config do |config|
|
||||||
|
config.chef.enabled = true
|
||||||
|
end
|
||||||
|
|
||||||
|
@default_order.push(Vagrant::Actions::Provision)
|
||||||
|
setup_action_expectations
|
||||||
|
@action.prepare
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ class CommandsTest < Test::Unit::TestCase
|
||||||
Vagrant::Env.stubs(:load!)
|
Vagrant::Env.stubs(:load!)
|
||||||
|
|
||||||
@persisted_vm = mock("persisted_vm")
|
@persisted_vm = mock("persisted_vm")
|
||||||
|
@persisted_vm.stubs(:execute!)
|
||||||
Vagrant::Env.stubs(:persisted_vm).returns(@persisted_vm)
|
Vagrant::Env.stubs(:persisted_vm).returns(@persisted_vm)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ class CommandsTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "call the `reload` action on the VM" do
|
should "call the `reload` action on the VM" do
|
||||||
Vagrant::VM.expects(:execute!).with(Vagrant::Actions::Reload).once
|
@persisted_vm.expects(:execute!).with(Vagrant::Actions::Reload).once
|
||||||
Vagrant::Commands.reload
|
Vagrant::Commands.reload
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue