Modify start to only boot for saved VMs, no sharing folders, etc.
This commit is contained in:
parent
fd3012ae00
commit
43f66c1693
|
@ -5,10 +5,10 @@ module Vagrant
|
|||
def prepare
|
||||
# Start is a "meta-action" so it really just queues up a bunch
|
||||
# of other actions in its place:
|
||||
steps = [ForwardPorts, SharedFolders, Boot]
|
||||
steps.unshift(Customize) unless @runner.vm.saved?
|
||||
steps = [Boot]
|
||||
steps.unshift([Customize, ForwardPorts, SharedFolders]) unless @runner.vm.saved?
|
||||
|
||||
steps.each do |action_klass|
|
||||
steps.flatten.each do |action_klass|
|
||||
@runner.add_action(action_klass)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -92,7 +92,7 @@ class ForwardPortsActionTest < Test::Unit::TestCase
|
|||
forwarded_ports = []
|
||||
5.times do |i|
|
||||
port = mock("port#{i}")
|
||||
port.expects(:destroy).with(true).once
|
||||
port.expects(:destroy).once
|
||||
forwarded_ports << port
|
||||
end
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@ class StartActionTest < Test::Unit::TestCase
|
|||
@vm.stubs(:saved?).returns(true)
|
||||
File.stubs(:file?).returns(true)
|
||||
File.stubs(:exist?).returns(true)
|
||||
@default_order = [Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders, Vagrant::Actions::VM::Boot]
|
||||
@default_order = [Vagrant::Actions::VM::Boot]
|
||||
end
|
||||
|
||||
def setup_action_expectations
|
||||
default_seq = sequence("default_seq")
|
||||
@default_order.each do |action|
|
||||
@default_order.flatten.each do |action|
|
||||
@mock_vm.expects(:add_action).with(action).once.in_sequence(default_seq)
|
||||
end
|
||||
end
|
||||
|
@ -27,7 +27,7 @@ class StartActionTest < Test::Unit::TestCase
|
|||
|
||||
should "add customize to the beginning if its not saved" do
|
||||
@vm.expects(:saved?).returns(false)
|
||||
@default_order.unshift(Vagrant::Actions::VM::Customize)
|
||||
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
||||
setup_action_expectations
|
||||
@action.prepare
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class SuspendActionTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "save the state of the VM" do
|
||||
@vm.expects(:save_state).with(true).once
|
||||
@vm.expects(:save_state).once
|
||||
@action.execute!
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue