File: fix-port-allocation-in-tests.patch

package info (click to toggle)
ruby-httpclient 2.3.3-3.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 852 kB
  • ctags: 1,120
  • sloc: ruby: 7,230; makefile: 2
file content (82 lines) | stat: -rw-r--r-- 2,649 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: Fix port allocation on test suite
 For some reason, when running the test suite under sbuild, several tests crash
 with an error of `Errno::EADDRINUSE: Address already in use - listen(2)`. The
 tests just work when building outside of sbuild.
 .
 Somehow, passing :Port => 0 seems to be making WEBrick allocate the same port
 over and over. I couldn't reproduce this interactively.
 .
 This patch fixes the issue by assigning explict port numbers to servers and
 proxy servers created in the test suite, and is most probably Debian-specific.
Author: Antonio Terceiro <terceiro@debian.org>

---
Origin: vendor
Bug-Debian: http://bugs.debian.org/747736
Forwarded: not-needed
Last-Update: 2014-06-26

--- a/test/helper.rb
+++ b/test/helper.rb
@@ -69,7 +69,7 @@ module Helper
     @proxyserver = WEBrick::HTTPProxyServer.new(
       :BindAddress => "localhost",
       :Logger => @proxylogger,
-      :Port => 0,
+      :Port => 50001,
       :AccessLog => []
     )
     @proxyport = @proxyserver.config[:Port]
--- a/test/test_auth.rb
+++ b/test/test_auth.rb
@@ -17,7 +17,7 @@ class TestAuth < Test::Unit::TestCase
     @server = WEBrick::HTTPServer.new(
       :BindAddress => "localhost",
       :Logger => @logger,
-      :Port => 0,
+      :Port => 50000,
       :AccessLog => [],
       :DocumentRoot => File.dirname(File.expand_path(__FILE__))
     )
@@ -68,7 +68,7 @@ class TestAuth < Test::Unit::TestCase
       :ProxyAuthProc => @proxy_digest_auth.method(:authenticate).to_proc,
       :BindAddress => "localhost",
       :Logger => @proxylogger,
-      :Port => 0,
+      :Port => 50001,
       :AccessLog => []
     )
     @proxyport = @proxyserver.config[:Port]
--- a/test/test_http-access2.rb
+++ b/test/test_http-access2.rb
@@ -386,7 +386,7 @@ private
     @server = WEBrick::HTTPServer.new(
       :BindAddress => "localhost",
       :Logger => @logger,
-      :Port => 0,
+      :Port => 50000,
       :AccessLog => [],
       :DocumentRoot => File.dirname(File.expand_path(__FILE__))
     )
--- a/test/test_httpclient.rb
+++ b/test/test_httpclient.rb
@@ -1599,7 +1599,7 @@ private
     @server = WEBrick::HTTPServer.new(
       :BindAddress => "localhost",
       :Logger => @logger,
-      :Port => 0,
+      :Port => 50000,
       :AccessLog => [],
       :DocumentRoot => File.dirname(File.expand_path(__FILE__))
     )
--- a/test/test_ssl.rb
+++ b/test/test_ssl.rb
@@ -186,7 +186,7 @@ private
     @server = WEBrick::HTTPServer.new(
       :BindAddress => "localhost",
       :Logger => logger,
-      :Port => 0,
+      :Port => 50000,
       :AccessLog => [],
       :DocumentRoot => DIR,
       :SSLEnable => true,