delete Docker containers after code execution
This commit is contained in:
@ -68,6 +68,7 @@ class DockerClient
|
|||||||
PortPool.release(port)
|
PortPool.release(port)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
container.delete(force: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute_command(command, &block)
|
def execute_command(command, &block)
|
||||||
|
@ -98,9 +98,12 @@ describe DockerClient, docker: true do
|
|||||||
|
|
||||||
it 'releases allocated ports' do
|
it 'releases allocated ports' do
|
||||||
expect(container).to receive(:json).at_least(:once).and_return({'HostConfig' => {'PortBindings' => {foo: [{'HostPort' => '42'}]}}})
|
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)
|
expect(PortPool).to receive(:release)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'deletes the container' do
|
||||||
|
expect(container).to receive(:delete)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#execute_command' do
|
describe '#execute_command' do
|
||||||
|
Reference in New Issue
Block a user