[DRE-commits] [ruby-httpclient] 07/18: Add patch to to wait until socket is free in tests

Hleb Valoshka tsfgnu-guest at moszumanska.debian.org
Thu Aug 27 10:37:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

tsfgnu-guest pushed a commit to branch master
in repository ruby-httpclient.

commit e87e08f759db7503dc61063de246a8f85850e29f
Author: Hleb Valoshka <375gnu at gmail.com>
Date:   Mon Aug 17 16:05:22 2015 +0300

    Add patch to to wait until socket is free in tests
---
 .../0003-Try-to-wait-until-socket-is-free.patch    | 124 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 125 insertions(+)

diff --git a/debian/patches/0003-Try-to-wait-until-socket-is-free.patch b/debian/patches/0003-Try-to-wait-until-socket-is-free.patch
new file mode 100644
index 0000000..7d6c6ff
--- /dev/null
+++ b/debian/patches/0003-Try-to-wait-until-socket-is-free.patch
@@ -0,0 +1,124 @@
+From: Hleb Valoshka <375gnu at gmail.com>
+Date: Mon, 17 Aug 2015 15:45:46 +0300
+Subject: Try to wait until socket is free
+
+---
+ test/helper.rb            |  3 +++
+ test/test_auth.rb         | 38 ++++++++++++++++++++++++--------------
+ test/test_http-access2.rb |  3 +++
+ test/test_httpclient.rb   |  3 +++
+ test/test_ssl.rb          |  3 +++
+ 5 files changed, 36 insertions(+), 14 deletions(-)
+
+diff --git a/test/helper.rb b/test/helper.rb
+index d89fa13..56418bb 100644
+--- a/test/helper.rb
++++ b/test/helper.rb
+@@ -74,6 +74,9 @@ module Helper
+     )
+     @proxyport = @proxyserver.config[:Port]
+     @proxyserver_thread = start_server_thread(@proxyserver)
++  rescue Errno::EADDRINUSE
++    sleep 1
++    retry
+   end
+ 
+   def teardown_client
+diff --git a/test/test_auth.rb b/test/test_auth.rb
+index ff8f55f..3a9503d 100644
+--- a/test/test_auth.rb
++++ b/test/test_auth.rb
+@@ -18,13 +18,18 @@ class TestAuth < Test::Unit::TestCase
+   end
+ 
+   def setup_server
+-    @server = WEBrick::HTTPServer.new(
+-      :BindAddress => "localhost",
+-      :Logger => @logger,
+-      :Port => 50000,
+-      :AccessLog => [],
+-      :DocumentRoot => File.dirname(File.expand_path(__FILE__))
+-    )
++    begin
++      @server = WEBrick::HTTPServer.new(
++        :BindAddress => "localhost",
++        :Logger => @logger,
++        :Port => 50000,
++        :AccessLog => [],
++        :DocumentRoot => File.dirname(File.expand_path(__FILE__))
++      )
++    rescue Errno::EADDRINUSE
++      sleep 1
++      retry
++    end
+     @serverport = @server.config[:Port]
+     @server.mount(
+       '/basic_auth',
+@@ -84,13 +89,18 @@ class TestAuth < Test::Unit::TestCase
+       :UserDB => htdigest_userdb
+     )
+ 
+-    @proxyserver = WEBrick::HTTPProxyServer.new(
+-      :ProxyAuthProc => @proxy_digest_auth.method(:authenticate).to_proc,
+-      :BindAddress => "localhost",
+-      :Logger => @proxylogger,
+-      :Port => 50001,
+-      :AccessLog => []
+-    )
++    begin
++      @proxyserver = WEBrick::HTTPProxyServer.new(
++        :ProxyAuthProc => @proxy_digest_auth.method(:authenticate).to_proc,
++        :BindAddress => "localhost",
++        :Logger => @proxylogger,
++        :Port => 50001,
++        :AccessLog => []
++      )
++    rescue Errno::EADDRINUSE
++      sleep 1
++      retry
++    end
+     @proxyport = @proxyserver.config[:Port]
+     @proxyserver_thread = start_server_thread(@proxyserver)
+   end
+diff --git a/test/test_http-access2.rb b/test/test_http-access2.rb
+index 23a941f..11e3555 100644
+--- a/test/test_http-access2.rb
++++ b/test/test_http-access2.rb
+@@ -398,6 +398,9 @@ private
+     end
+     @server.mount('/servlet', TestServlet.new(@server))
+     @server_thread = start_server_thread(@server)
++  rescue Errno::EADDRINUSE
++    sleep 1
++    retry
+   end
+ 
+   def escape_noproxy
+diff --git a/test/test_httpclient.rb b/test/test_httpclient.rb
+index b45deb1..95c2ca9 100644
+--- a/test/test_httpclient.rb
++++ b/test/test_httpclient.rb
+@@ -1838,6 +1838,9 @@ private
+     end
+     @server.mount('/servlet', TestServlet.new(@server))
+     @server_thread = start_server_thread(@server)
++  rescue Errno::EADDRINUSE
++    sleep 1
++    retry
+   end
+ 
+   def escape_noproxy
+diff --git a/test/test_ssl.rb b/test/test_ssl.rb
+index c12f9e2..d0a2afa 100644
+--- a/test/test_ssl.rb
++++ b/test/test_ssl.rb
+@@ -226,6 +226,9 @@ private
+       )
+     end
+     @server_thread = start_server_thread(@server)
++  rescue Errno::EADDRINUSE
++    sleep 1
++    retry
+   end
+ 
+   def setup_server_with_ssl_version(ssl_version)
diff --git a/debian/patches/series b/debian/patches/series
index c54024b..e339bda 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Fix-port-allocation-in-tests.patch
 0002-Disable-tests-for-NTLM.patch
+0003-Try-to-wait-until-socket-is-free.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-httpclient.git



More information about the Pkg-ruby-extras-commits mailing list