[前][次][番号順一覧][スレッド一覧]

ruby-changes:36251

From: akr <ko1@a...>
Date: Sun, 9 Nov 2014 11:49:24 +0900 (JST)
Subject: [ruby-changes:36251] akr:r48332 (trunk): * test/net/http: Examine webrick log.

akr	2014-11-09 11:49:13 +0900 (Sun, 09 Nov 2014)

  New Revision: 48332

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48332

  Log:
    * test/net/http: Examine webrick log.

  Modified files:
    trunk/ChangeLog
    trunk/test/net/http/test_http.rb
    trunk/test/net/http/test_https.rb
    trunk/test/net/http/utils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48331)
+++ ChangeLog	(revision 48332)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov  9 11:48:40 2014  Tanaka Akira  <akr@f...>
+
+	* test/net/http: Examine webrick log.
+
 Sun Nov  9 11:45:19 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* gems/bundled_gems: upgraded to test-unit 3.0.5.
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 48331)
+++ test/net/http/test_http.rb	(revision 48332)
@@ -277,6 +277,7 @@ module TestNetHTTP_version_1_1_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L277
       end
     }
     assert_equal 1, i
+    @log_pattern = nil # server may encount ECONNRESET
   end
 
   def test_get__implicit_start
Index: test/net/http/utils.rb
===================================================================
--- test/net/http/utils.rb	(revision 48331)
+++ test/net/http/utils.rb	(revision 48332)
@@ -36,16 +36,19 @@ module TestNetHTTPUtils https://github.com/ruby/ruby/blob/trunk/test/net/http/utils.rb#L36
       @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,
     }
Index: test/net/http/test_https.rb
===================================================================
--- test/net/http/test_https.rb	(revision 48331)
+++ test/net/http/test_https.rb	(revision 48332)
@@ -117,6 +117,7 @@ class TestNetHTTPS < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/net/http/test_https.rb#L117
       end
     }
     assert_match(/certificate verify failed/, ex.message)
+    @log_pattern = /ERROR OpenSSL::SSL::SSLError:/
   end
 
   def test_identity_verify_failure

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]