Add strategy for DockerContainerPool

In order to provide an alternative to Poseidon, a strategy for the
DockerContainerPool is added that is used by the runner model.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
This commit is contained in:
Felix Auringer
2021-06-10 16:17:02 +02:00
committed by Sebastian Serth
parent 1d3f0d7ad8
commit 704407b9fc
12 changed files with 282 additions and 69 deletions

View File

@ -256,15 +256,15 @@ describe Runner::Strategy::Poseidon do
end
describe '#copy_files' do
let(:filename) { 'main.py' }
let(:file_content) { 'print("Hello World!")' }
let(:action) { -> { poseidon.copy_files({filename => file_content}) } }
let(:encoded_file_content) { Base64.strict_encode64(file_content) }
let(:file) { FactoryBot.build(:file, content: file_content) }
let(:action) { -> { poseidon.copy_files([file]) } }
let(:encoded_file_content) { Base64.strict_encode64(file.content) }
let!(:copy_files_stub) do
WebMock
.stub_request(:patch, "#{Runner::BASE_URL}/runners/#{runner_id}/files")
.with(
body: {copy: [{path: filename, content: encoded_file_content}]},
body: {copy: [{path: file.filepath, content: encoded_file_content}]},
headers: {'Content-Type' => 'application/json'}
)
.to_return(body: response_body, status: response_status)