From ed20a305170fc05acb40f5c4a9e09a0425407fac Mon Sep 17 00:00:00 2001 From: yqbk Date: Tue, 7 Jun 2016 13:52:01 +0200 Subject: [PATCH] reverse some changes --- lib/docker_client.rb | 7 ++----- spec/lib/docker_container_pool_spec.rb | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/docker_client.rb b/lib/docker_client.rb index 6978de80..3c811cdb 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -28,7 +28,7 @@ class DockerClient path_to_delete = Pathname.new(local_workspace_path) if local_workspace_path || Pathname.new(local_workspace_path).exist? path_to_delete.children.each{ |p| p.rmtree} - FileUtils.rmdir(path_to_delete) + #FileUtils.rmdir(path_to_delete) end end @@ -70,13 +70,10 @@ class DockerClient # todo separate stderr query_params = 'logs=0&stream=1&' + (stderr ? 'stderr=1' : 'stdout=1&stdin=1') - # Should be hosts instead of ws_hosts, right? - client_params = DockerClient.config['host'] + '/containers/' + @container.id + '/attach/ws?' + query_params - # Headers are required by Docker headers = {'Origin' => 'http://localhost'} - socket = Faye::WebSocket::Client.new(client_params, [], :headers => headers) + socket = Faye::WebSocket::Client.new(DockerClient.config['ws_host'] + '/containers/' + @container.id + '/attach/ws?' + query_params, [], :headers => headers) socket.on :error do |event| Rails.logger.info "Websocket error: " + event.message diff --git a/spec/lib/docker_container_pool_spec.rb b/spec/lib/docker_container_pool_spec.rb index e16e9d11..6815065d 100644 --- a/spec/lib/docker_container_pool_spec.rb +++ b/spec/lib/docker_container_pool_spec.rb @@ -44,6 +44,8 @@ describe DockerContainerPool do it 'takes a container from the pool' do expect(described_class).not_to receive(:create_container).with(@execution_environment) + # # received unexpected message :json with (no args) + # expect(described_class).to receive(:json).with() expect(described_class.get_container(@execution_environment)).to eq(container) end end @@ -60,6 +62,7 @@ describe DockerContainerPool do end end + context 'when inactive' do before(:each) do expect(described_class).to receive(:config).and_return(active: false)