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

ruby-changes:15763

From: shugo <ko1@a...>
Date: Sun, 9 May 2010 09:17:10 +0900 (JST)
Subject: [ruby-changes:15763] Ruby:r27691 (trunk): * test/net/imap/test_imap.rb: use IPv4 for

shugo	2010-05-09 09:16:48 +0900 (Sun, 09 May 2010)

  New Revision: 27691

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

  Log:
    * test/net/imap/test_imap.rb: use IPv4 for
      test_imaps_post_connection_check.  [ruby-dev:41189]

  Modified files:
    trunk/ChangeLog
    trunk/test/net/imap/test_imap.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27690)
+++ ChangeLog	(revision 27691)
@@ -1,3 +1,8 @@
+Sun May  9 09:15:03 2010  Shugo Maeda  <shugo@r...>
+
+	* test/net/imap/test_imap.rb: use IPv4 for
+	  test_imaps_post_connection_check.  [ruby-dev:41189]
+
 Sun May  9 08:24:24 2010  Shugo Maeda  <shugo@r...>
 
 	* lib/net/imap.rb (disconnect): terminates @receiver_thread even if
Index: test/net/imap/test_imap.rb
===================================================================
--- test/net/imap/test_imap.rb	(revision 27690)
+++ test/net/imap/test_imap.rb	(revision 27691)
@@ -6,6 +6,8 @@
   SERVER_KEY = File.expand_path("server.key", File.dirname(__FILE__))
   SERVER_CERT = File.expand_path("server.crt", File.dirname(__FILE__))
 
+  SERVER_ADDR = "127.0.0.1"
+
   def setup
     @do_not_reverse_lookup = Socket.do_not_reverse_lookup
     Socket.do_not_reverse_lookup = true
@@ -83,7 +85,9 @@
     if defined?(OpenSSL)
       assert_raise(OpenSSL::SSL::SSLError) do
         imaps_test do |port|
-          Net::IMAP.new("127.0.0.1",
+          # SERVER_ADDR is different from the hostname in the certificate,
+          # so the following code should raise a SSLError.
+          Net::IMAP.new(SERVER_ADDR,
                         :port => port,
                         :ssl => { :ca_file => CA_FILE })
         end
@@ -107,7 +111,7 @@
   end
 
   def test_unexpected_eof
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     Thread.start do
       begin
@@ -138,7 +142,7 @@
   end
 
   def test_idle
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     requests = []
     Thread.start do
@@ -190,7 +194,7 @@
   end
 
   def test_exception_during_idle
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     requests = []
     Thread.start do
@@ -255,7 +259,7 @@
   end
 
   def test_idle_done_not_during_idle
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     requests = []
     Thread.start do
@@ -284,7 +288,7 @@
   end
 
   def test_unexpected_bye
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     Thread.start do
       begin
@@ -312,7 +316,7 @@
   end
 
   def test_exception_during_shutdown
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     Thread.start do
       begin
@@ -351,7 +355,7 @@
   private
 
   def imaps_test
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     ctx = OpenSSL::SSL::SSLContext.new
     ctx.ca_file = CA_FILE
@@ -389,7 +393,7 @@
   end
 
   def starttls_test
-    server = TCPServer.new(0)
+    server = create_tcp_server
     port = server.addr[1]
     Thread.start do
       begin
@@ -428,4 +432,8 @@
       server.close
     end
   end
+
+  def create_tcp_server
+    return TCPServer.new(SERVER_ADDR, 0)
+  end
 end

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

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