Waits for container to be running after "lxc-start"ing it
This commit is contained in:
parent
f1623a9136
commit
4a9d74514e
2 changed files with 10 additions and 11 deletions
|
@ -28,6 +28,7 @@ module Vagrant
|
|||
|
||||
def start
|
||||
lxc :start, '-d', '--name', @machine.id
|
||||
wait_until :running
|
||||
end
|
||||
|
||||
def halt
|
||||
|
|
|
@ -15,7 +15,7 @@ describe Vagrant::LXC::Container do
|
|||
subject.lxc :command, '--state', 'RUNNING'
|
||||
end
|
||||
|
||||
it 'prepends sudo for execution' do
|
||||
it 'prepends sudo' do
|
||||
args[0].should == 'sudo'
|
||||
end
|
||||
|
||||
|
@ -73,22 +73,20 @@ describe Vagrant::LXC::Container do
|
|||
end
|
||||
|
||||
describe 'start' do
|
||||
let(:last_command) { @last_command }
|
||||
let(:machine_id) { 'random-machine-id' }
|
||||
let(:machine) { fire_double('Vagrant::Machine', id: machine_id) }
|
||||
let(:machine_id) { 'random-machine-id' }
|
||||
let(:machine) { fire_double('Vagrant::Machine', id: machine_id) }
|
||||
|
||||
before do
|
||||
subject.stub(:lxc) do |*cmds|
|
||||
@last_command = cmds.join(' ')
|
||||
mock(exit_code: 0, stdout: '')
|
||||
end
|
||||
subject.stub(lxc: true, wait_until: true)
|
||||
subject.start
|
||||
end
|
||||
|
||||
it 'calls lxc-start with the right arguments' do
|
||||
last_command.should =~ /^start/
|
||||
last_command.should include "--name #{machine_id}"
|
||||
last_command.should include '-d'
|
||||
subject.should have_received(:lxc).with(:start, '-d', '--name', machine.id)
|
||||
end
|
||||
|
||||
it 'waits for container state to be RUNNING' do
|
||||
subject.should have_received(:wait_until).with(:running)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue