diff options
Diffstat (limited to 'test/unit/test_ccc.rb')
-rw-r--r-- | test/unit/test_ccc.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/unit/test_ccc.rb b/test/unit/test_ccc.rb index 3be1439..a0a2bff 100644 --- a/test/unit/test_ccc.rb +++ b/test/unit/test_ccc.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: false require 'socket' require 'unicorn' require 'io/wait' require 'tempfile' require 'test/unit' +require './test/test_helper' class TestCccTCPI < Test::Unit::TestCase def test_ccc_tcpi @@ -28,7 +30,7 @@ class TestCccTCPI < Test::Unit::TestCase # will wake up when writer closes sleep_pipe[0].read if env['PATH_INFO'] == '/sleep' - [ 200, [ %w(Content-Length 0), %w(Content-Type text/plain) ], [] ] + [ 200, {'content-length'=>'0', 'content-type'=>'text/plain'}, [] ] end ENV['UNICORN_FD'] = srv.fileno.to_s opts = { @@ -42,7 +44,7 @@ class TestCccTCPI < Test::Unit::TestCase wr.close # make sure the server is running, at least - client = TCPSocket.new(host, port) + client = tcp_socket(host, port) client.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n") assert client.wait(10), 'never got response from server' res = client.read @@ -51,13 +53,13 @@ class TestCccTCPI < Test::Unit::TestCase client.close # start a slow request... - sleeper = TCPSocket.new(host, port) + sleeper = tcp_socket(host, port) sleeper.write("GET /sleep HTTP/1.1\r\nHost: example.com\r\n\r\n") # and a bunch of aborted ones nr = 100 nr.times do |i| - client = TCPSocket.new(host, port) + client = tcp_socket(host, port) client.write("GET /collections/#{rand(10000)} HTTP/1.1\r\n" \ "Host: example.com\r\n\r\n") client.close |