You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/03/16 20:55:18 UTC
qpid-proton git commit: NO-JIRA: [ruby] Fix race condition in
container tests.
Repository: qpid-proton
Updated Branches:
refs/heads/master 828405a23 -> 035b4cb6e
NO-JIRA: [ruby] Fix race condition in container tests.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/035b4cb6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/035b4cb6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/035b4cb6
Branch: refs/heads/master
Commit: 035b4cb6e053b1f15e18efddadc97b59b58c4384
Parents: 828405a
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Mar 16 16:44:06 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Mar 16 16:44:06 2018 -0400
----------------------------------------------------------------------
proton-c/bindings/ruby/tests/test_tools.rb | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b4cb6/proton-c/bindings/ruby/tests/test_tools.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_tools.rb b/proton-c/bindings/ruby/tests/test_tools.rb
index 07df5e7..37e757c 100644
--- a/proton-c/bindings/ruby/tests/test_tools.rb
+++ b/proton-c/bindings/ruby/tests/test_tools.rb
@@ -150,10 +150,20 @@ end
class ServerContainer < Qpid::Proton::Container
include Qpid::Proton
+ class ListenerHandler < Listener::Handler
+ def initialize(opts) super; @ready = Queue.new; end
+ def on_open(l) @ready.push nil; end
+ def wait() @ready.pop; end
+ end
+
def initialize(id=nil, listener_opts=nil)
super id
- @listener = listen_io(TCPServer.open(0), Listener::Handler.new(listener_opts))
+ lh = ListenerHandler.new(listener_opts)
+ @listener = listen_io(TCPServer.open(0), lh)
@thread = Thread.new { run }
+ # Wait for listener to avoid nasty race conditions where a test closes the
+ # listener before it opens and therefore nothing happens.
+ lh.wait
end
attr_reader :listener
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org