diff --git a/ChangeLog b/ChangeLog index 5490fb4c11..7467888294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Nov 9 11:48:40 2014 Tanaka Akira + + * test/net/http: Examine webrick log. + Sun Nov 9 11:45:19 2014 SHIBATA Hiroshi * gems/bundled_gems: upgraded to test-unit 3.0.5. diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 704456f3a3..bd0d960b96 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -277,6 +277,7 @@ module TestNetHTTP_version_1_1_methods end } assert_equal 1, i + @log_pattern = nil # server may encount ECONNRESET end def test_get__implicit_start diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index 0df003bdda..89845c584a 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -117,6 +117,7 @@ class TestNetHTTPS < Test::Unit::TestCase end } assert_match(/certificate verify failed/, ex.message) + @log_pattern = /ERROR OpenSSL::SSL::SSLError:/ end def test_identity_verify_failure diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb index 7afef411ec..3bf7695532 100644 --- a/test/net/http/utils.rb +++ b/test/net/http/utils.rb @@ -36,16 +36,19 @@ module TestNetHTTPUtils @server.shutdown @server_thread.join end + assert_match(@log_pattern, @log.string) if @log_pattern # resume global state Net::HTTP.version_1_2 end def spawn_server + @log = StringIO.new('') + @log_pattern = /\A\z/ @config = self.class::CONFIG server_config = { :BindAddress => config('host'), :Port => 0, - :Logger => WEBrick::Log.new(NullWriter.new), + :Logger => WEBrick::Log.new(@log, WEBrick::BasicLog::WARN), :AccessLog => [], :ServerType => Thread, }