[DRE-commits] [ruby-redis] 02/03: added patch to use random port on unit tests
Jonas Genannt
jonas at brachium-system.net
Mon Jul 28 17:42:35 UTC 2014
This is an automated email from the git hooks/post-receive script.
hggh-guest pushed a commit to branch master
in repository ruby-redis.
commit 25aa17a24a2b4d68fa265d96522282679f085080
Author: Jonas Genannt <jonas at brachium-system.net>
Date: Mon Jul 28 19:40:22 2014 +0200
added patch to use random port on unit tests
---
debian/patches/test_internal_random_port.patch | 30 ++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/debian/patches/test_internal_random_port.patch b/debian/patches/test_internal_random_port.patch
new file mode 100644
index 0000000..73daf96
--- /dev/null
+++ b/debian/patches/test_internal_random_port.patch
@@ -0,0 +1,30 @@
+Description: use random port for tests
+Author: Jonas Genannt
+Forwarded: yes
+Bug: https://github.com/redis/redis-rb/pull/455
+
+diff --git a/test/internals_test.rb b/test/internals_test.rb
+index 0c0f7bc..7e3d61d 100644
+--- a/test/internals_test.rb
++++ b/test/internals_test.rb
+@@ -375,8 +375,18 @@ class TestInternals < Test::Unit::TestCase
+ begin
+ s = Socket.new(af, Socket::SOCK_STREAM, 0)
+ begin
+- sa = Socket.pack_sockaddr_in(9999, hosts[af])
+- s.bind(sa)
++ tries = 5
++ begin
++ sa = Socket.pack_sockaddr_in(Random.rand(1024..65000), hosts[af])
++ s.bind(sa)
++ rescue Errno::EADDRINUSE => e
++ tries -= 1
++ if tries > 0
++ retry
++ else
++ raise Errno::EADDRINUSE, e
++ end
++ end
+ yield
+ rescue Errno::EADDRNOTAVAIL
+ ensure
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-redis.git
More information about the Pkg-ruby-extras-commits
mailing list