delete Docker containers after code execution

This commit is contained in:
Hauke Klement
2015-01-22 15:06:27 +01:00
parent 41ed4c8f9f
commit 4dbb144f59
2 changed files with 5 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class DockerClient
PortPool.release(port)
end
end
container.delete(force: true)
end
def execute_command(command, &block)

View File

@ -98,9 +98,12 @@ describe DockerClient, docker: true do
it 'releases allocated ports' do
expect(container).to receive(:json).at_least(:once).and_return({'HostConfig' => {'PortBindings' => {foo: [{'HostPort' => '42'}]}}})
docker_client.send(:start_container, container)
expect(PortPool).to receive(:release)
end
it 'deletes the container' do
expect(container).to receive(:delete)
end
end
describe '#execute_command' do