You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2023/04/20 11:42:33 UTC

[qpid-proton] branch main updated: PROTON-2706: PROTON-2706: Allow the user to explicitly set Container.container_id to None

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 4a63d6f06 PROTON-2706: PROTON-2706: Allow the user to explicitly set Container.container_id to None
4a63d6f06 is described below

commit 4a63d6f06949cdd0c727db686d18c317bde3b438
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Thu Apr 20 07:39:52 2023 -0400

    PROTON-2706: PROTON-2706: Allow the user to explicitly set Container.container_id to None
    
    The previous fix was incomplete and didn't handle the case of
    explicitly setting the container_id to None in the connect call.
---
 python/proton/_reactor.py            |  2 +-
 python/tests/proton_tests/reactor.py | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index 5564263d3..b00728f75 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -1362,7 +1362,7 @@ class Container(Reactor):
             **kwargs
     ) -> Connection:
         conn = self.connection(handler)
-        conn.container = kwargs.get('container_id', self.container_id or str(_generate_uuid()))
+        conn.container = kwargs.get('container_id', self.container_id) or str(_generate_uuid())
         conn.offered_capabilities = kwargs.get('offered_capabilities')
         conn.desired_capabilities = kwargs.get('desired_capabilities')
         conn.properties = kwargs.get('properties')
diff --git a/python/tests/proton_tests/reactor.py b/python/tests/proton_tests/reactor.py
index 28caad651..7f1d29c62 100644
--- a/python/tests/proton_tests/reactor.py
+++ b/python/tests/proton_tests/reactor.py
@@ -513,13 +513,21 @@ class ContainerTest(Test):
 
     def test_container_id_3(self):
         server_handler = ContainerTest._ServerHandler("localhost")
-        container = Container(server_handler)
-        container.container_id = None
+        container = Container(server_handler, container_id = None)
         conn = container.connect(url="localhost:%s" % (server_handler.port),
                                  handler=ContainerTest._ClientHandler())
         container.run()
         assert server_handler.peer_container_id != '', server_handler.peer_container_id
 
+    def test_container_id_4(self):
+        server_handler = ContainerTest._ServerHandler("localhost")
+        container = Container(server_handler)
+        conn = container.connect(url="localhost:%s" % (server_handler.port),
+                                 handler=ContainerTest._ClientHandler(),
+                                 container_id=None)
+        container.run()
+        assert server_handler.peer_container_id != '', server_handler.peer_container_id
+
     def test_virtual_host(self):
         ensureCanTestExtendedSASL()
         server_handler = ContainerTest._ServerHandler("localhost")


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