From ea5295e8e4dcfaec24efb5030557594aabe645cb Mon Sep 17 00:00:00 2001 From: "bofh@yhbt.net" Date: Sun, 14 Mar 2021 23:17:24 +0000 Subject: tests: force blocking I/O for Ruby 3.x Otherwise we get test failures since we use sysread and syswrite in many places --- test/unit/test_ccc.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/unit/test_ccc.rb') diff --git a/test/unit/test_ccc.rb b/test/unit/test_ccc.rb index 3be1439..0dc72e8 100644 --- a/test/unit/test_ccc.rb +++ b/test/unit/test_ccc.rb @@ -3,6 +3,7 @@ require 'unicorn' require 'io/wait' require 'tempfile' require 'test/unit' +require './test/test_helper' class TestCccTCPI < Test::Unit::TestCase def test_ccc_tcpi @@ -42,7 +43,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 +52,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 -- cgit v1.2.3-24-ge0c7