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
|
def start
|
||||||
lxc :start, '-d', '--name', @machine.id
|
lxc :start, '-d', '--name', @machine.id
|
||||||
|
wait_until :running
|
||||||
end
|
end
|
||||||
|
|
||||||
def halt
|
def halt
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe Vagrant::LXC::Container do
|
||||||
subject.lxc :command, '--state', 'RUNNING'
|
subject.lxc :command, '--state', 'RUNNING'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'prepends sudo for execution' do
|
it 'prepends sudo' do
|
||||||
args[0].should == 'sudo'
|
args[0].should == 'sudo'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -73,22 +73,20 @@ describe Vagrant::LXC::Container do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'start' do
|
describe 'start' do
|
||||||
let(:last_command) { @last_command }
|
|
||||||
let(:machine_id) { 'random-machine-id' }
|
let(:machine_id) { 'random-machine-id' }
|
||||||
let(:machine) { fire_double('Vagrant::Machine', id: machine_id) }
|
let(:machine) { fire_double('Vagrant::Machine', id: machine_id) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject.stub(:lxc) do |*cmds|
|
subject.stub(lxc: true, wait_until: true)
|
||||||
@last_command = cmds.join(' ')
|
|
||||||
mock(exit_code: 0, stdout: '')
|
|
||||||
end
|
|
||||||
subject.start
|
subject.start
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'calls lxc-start with the right arguments' do
|
it 'calls lxc-start with the right arguments' do
|
||||||
last_command.should =~ /^start/
|
subject.should have_received(:lxc).with(:start, '-d', '--name', machine.id)
|
||||||
last_command.should include "--name #{machine_id}"
|
end
|
||||||
last_command.should include '-d'
|
|
||||||
|
it 'waits for container state to be RUNNING' do
|
||||||
|
subject.should have_received(:wait_until).with(:running)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue