You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by mgoulish <gi...@git.apache.org> on 2016/12/21 20:40:24 UTC

[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

GitHub user mgoulish opened a pull request:

    https://github.com/apache/qpid-dispatch/pull/134

    DISPATCH-209 : dynamic request response test

    phew.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mgoulish/qpid-dispatch DISPATCH-209-H

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-dispatch/pull/134.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #134
    
----
commit 19612e54caa329a7647389389d11a88c7c358853
Author: mick <mi...@redhat.com>
Date:   2016-12-21T20:38:30Z

    DISPATCH-209 : dynamic request response test

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r94648343
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -220,6 +225,70 @@ def run(self):
             Container(self).run()
      
      
    +class DynamicRequestResponseTest(MessagingHandler):
    +    def __init__(self, address1, address2):
    +        super(DynamicRequestResponseTest, self).__init__(prefetch=0)
    +        self.address1   = address1
    +        self.address2   = address2
    +        self.dest       = "closest.dynamicRequestResponse"
    +        self.error      = None
    +        self.sender     = None
    +        self.server_receiver = None
    +        self.client_receiver = None
    +        self.n_expected = 10
    +        self.n_sent     = 0
    +        self.n_received = 0
    +        self.n_accepted = 0
    + 
    +    def timeout(self):
    +        self.error = "Timeout Expired %d messages received." % self.n_received
    --- End diff --
    
    You should include all of the counters here.  If the test times out, you'll want as much information as you can get.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r93624286
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -220,6 +225,71 @@ def run(self):
             Container(self).run()
      
      
    +class DynamicRequestResponseTest(MessagingHandler):
    +    def __init__(self, address1, address2):
    +        super(DynamicRequestResponseTest, self).__init__(prefetch=0)
    +        self.address1   = address1
    +        self.address2   = address2
    +        self.dest       = "closest.whatever"
    +        self.error      = None
    +        self.sender     = None
    +        self.server_receiver = None
    +        self.client_receiver = None
    +        self.n_expected = 10
    +        self.n_sent     = 0
    +        self.n_received = 0
    +        self.n_accepted = 0
    + 
    +    def timeout(self):
    +        self.error = "Timeout Expired %d messages received." % self.n_received
    +        self.conn1.close()
    +        self.conn2.close()
    + 
    +    def on_released(self, event):
    +        self.n_sent -= 1
    +        time.sleep(0.1)
    +
    +    def on_link_opened(self, event):
    +        if event.receiver:
    +            self.sender = event.container.create_sender(self.conn1, None)
    +
    +    def on_start(self, event):
    +        self.timer = event.reactor.schedule(5, Timeout(self))
    +        self.conn1 = event.container.connect(self.address1)
    +        self.conn2 = event.container.connect(self.address2)
    +        self.server_receiver = event.container.create_receiver(self.conn2, self.dest)
    +        self.client_receiver = event.container.create_receiver(self.conn2, None, dynamic=True)
    --- End diff --
    
    Both the client and server receivers are established on the same connection.  Is this what was intended?  I would think that one connection would be the client and the other the server.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r93624041
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -220,6 +225,71 @@ def run(self):
             Container(self).run()
      
      
    +class DynamicRequestResponseTest(MessagingHandler):
    +    def __init__(self, address1, address2):
    +        super(DynamicRequestResponseTest, self).__init__(prefetch=0)
    +        self.address1   = address1
    +        self.address2   = address2
    +        self.dest       = "closest.whatever"
    +        self.error      = None
    +        self.sender     = None
    +        self.server_receiver = None
    +        self.client_receiver = None
    +        self.n_expected = 10
    +        self.n_sent     = 0
    +        self.n_received = 0
    +        self.n_accepted = 0
    + 
    +    def timeout(self):
    +        self.error = "Timeout Expired %d messages received." % self.n_received
    +        self.conn1.close()
    +        self.conn2.close()
    + 
    +    def on_released(self, event):
    +        self.n_sent -= 1
    +        time.sleep(0.1)
    +
    +    def on_link_opened(self, event):
    +        if event.receiver:
    +            self.sender = event.container.create_sender(self.conn1, None)
    --- End diff --
    
    You are going to get two on_link_opened events for receivers.  This means you are creating the same sender twice.  This one sender is used for both client-send and server-send operations.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r94681419
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -220,6 +225,70 @@ def run(self):
             Container(self).run()
      
      
    +class DynamicRequestResponseTest(MessagingHandler):
    +    def __init__(self, address1, address2):
    +        super(DynamicRequestResponseTest, self).__init__(prefetch=0)
    +        self.address1   = address1
    +        self.address2   = address2
    +        self.dest       = "closest.dynamicRequestResponse"
    +        self.error      = None
    +        self.sender     = None
    +        self.server_receiver = None
    +        self.client_receiver = None
    +        self.n_expected = 10
    +        self.n_sent     = 0
    +        self.n_received = 0
    +        self.n_accepted = 0
    + 
    +    def timeout(self):
    +        self.error = "Timeout Expired %d messages received." % self.n_received
    +        self.client_connection.close()
    +        self.server_connection.close()
    + 
    +    def on_released(self, event):
    +        self.n_sent -= 1
    +        time.sleep(0.1)
    +
    +    def on_start(self, event):
    +        self.timer = event.reactor.schedule(5, Timeout(self))
    +        self.client_connection = event.container.connect(self.address1)
    +        self.server_connection = event.container.connect(self.address2)
    +        self.server_receiver = event.container.create_receiver(self.server_connection, self.dest)
    +        self.client_receiver = event.container.create_receiver(self.client_connection, None, dynamic=True)
    +        self.server_receiver.flow(self.n_expected)
    +        self.client_receiver.flow(self.n_expected)
    +        self.sender = event.container.create_sender(self.client_connection, None)
    + 
    +    def on_sendable(self, event):
    +        if self.n_sent < self.n_expected:
    +            # We send to server, and ask it to reply to client.
    +            request = Message(body=self.n_sent, address=self.dest, reply_to=self.client_receiver.remote_source.address)
    +            event.sender.send(request)
    +            self.n_sent += 1
    + 
    +    def on_accepted(self, event):
    +        self.n_accepted += 1
    + 
    +    def on_message(self, event):
    +
    +        # Receiver gets a message and replies to client.
    +        if event.receiver == self.server_receiver :
    +            self.sender.send ( Message(address=event.message.reply_to, body="Reply hazy, try again later.") )
    --- End diff --
    
    The server is sending its responses on the client's sender!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by mgoulish <gi...@git.apache.org>.
Github user mgoulish closed the pull request at:

    https://github.com/apache/qpid-dispatch/pull/134


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r94648607
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -220,6 +225,70 @@ def run(self):
             Container(self).run()
      
      
    +class DynamicRequestResponseTest(MessagingHandler):
    +    def __init__(self, address1, address2):
    +        super(DynamicRequestResponseTest, self).__init__(prefetch=0)
    +        self.address1   = address1
    +        self.address2   = address2
    +        self.dest       = "closest.dynamicRequestResponse"
    +        self.error      = None
    +        self.sender     = None
    +        self.server_receiver = None
    +        self.client_receiver = None
    +        self.n_expected = 10
    +        self.n_sent     = 0
    +        self.n_received = 0
    +        self.n_accepted = 0
    + 
    +    def timeout(self):
    +        self.error = "Timeout Expired %d messages received." % self.n_received
    +        self.client_connection.close()
    +        self.server_connection.close()
    + 
    +    def on_released(self, event):
    +        self.n_sent -= 1
    +        time.sleep(0.1)
    +
    +    def on_start(self, event):
    +        self.timer = event.reactor.schedule(5, Timeout(self))
    +        self.client_connection = event.container.connect(self.address1)
    +        self.server_connection = event.container.connect(self.address2)
    +        self.server_receiver = event.container.create_receiver(self.server_connection, self.dest)
    +        self.client_receiver = event.container.create_receiver(self.client_connection, None, dynamic=True)
    +        self.server_receiver.flow(self.n_expected)
    +        self.client_receiver.flow(self.n_expected)
    +        self.sender = event.container.create_sender(self.client_connection, None)
    + 
    +    def on_sendable(self, event):
    +        if self.n_sent < self.n_expected:
    +            # We send to server, and ask it to reply to client.
    +            request = Message(body=self.n_sent, address=self.dest, reply_to=self.client_receiver.remote_source.address)
    --- End diff --
    
    There's a race condition here.  What if you get credit on the sender before the dynamic receiver is fully attached?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #134: DISPATCH-209 : dynamic request response tes...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/134#discussion_r94648211
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -90,6 +90,11 @@ def test_02_anonymous_sender(self):
             test.run()
             self.assertEqual(None, test.error)
     
    +    def test_03_dynamic_request_response(self):
    --- End diff --
    
    You can get multiple tests in one here just by replicating this test with different router addresses.  For example, you could have three tests:  0->0, 0->1, 0->2.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org