lxc-shutdown: check

This commit is contained in:
Fabio Rehm 2013-03-02 01:20:27 -03:00
parent 5291f13316
commit da534c3b0e
2 changed files with 22 additions and 1 deletions

View file

@ -42,7 +42,8 @@ module Vagrant
end end
def halt def halt
update!(:poweroff) lxc :shutdown, '--name', @name
wait_until :stopped
end end
def destroy def destroy

View file

@ -117,6 +117,26 @@ describe Vagrant::LXC::Container do
end end
end end
describe 'halt' do
let(:name) { 'random-container-name' }
before do
subject.stub(lxc: true, wait_until: true)
subject.halt
end
it 'calls lxc-shutdown with the right arguments' do
subject.should have_received(:lxc).with(
:shutdown,
'--name', name
)
end
it 'waits for container state to be STOPPED' do
subject.should have_received(:wait_until).with(:stopped)
end
end
describe 'state' do describe 'state' do
let(:name) { 'random-container-name' } let(:name) { 'random-container-name' }