PROTON-853: add a test that catches the issue from PROTON-154 (and PROTON-850)


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/252f5f0c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/252f5f0c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/252f5f0c

Branch: refs/heads/master
Commit: 252f5f0c1a3cb50edac7813eb233a37697e1f2ab
Parents: d2262bb
Author: Robert Gemmell <rob...@apache.org>
Authored: Mon Apr 20 17:39:25 2015 +0100
Committer: Robert Gemmell <rob...@apache.org>
Committed: Wed Apr 22 19:26:33 2015 +0100

----------------------------------------------------------------------
 tests/python/proton_tests/engine.py | 44 ++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/252f5f0c/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py 
b/tests/python/proton_tests/engine.py
index b8b165a..3944b85 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -369,6 +369,50 @@ class SessionTest(Test):
     self.pump()
     assert rcv_ssn.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_CLOSED
 
+  def test_reopen_on_same_session_without_free(self):
+    """
+    confirm that a link is correctly opened when attaching to a previously
+    closed link *that has not been freed yet* on the same session
+    """
+    self.ssn.open()
+    self.pump()
+
+    ssn2 = self.c2.session_head(Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_ACTIVE)
+    ssn2.open()
+    self.pump()
+    snd = self.ssn.sender("test-link")
+    rcv = ssn2.receiver("test-link")
+
+    assert snd.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_UNINIT
+    assert rcv.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_UNINIT
+
+    snd.open()
+    rcv.open()
+    self.pump()
+
+    assert snd.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+    assert rcv.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+
+    snd.close()
+    rcv.close()
+    self.pump()
+
+    assert snd.state == Endpoint.LOCAL_CLOSED | Endpoint.REMOTE_CLOSED
+    assert rcv.state == Endpoint.LOCAL_CLOSED | Endpoint.REMOTE_CLOSED
+
+    snd = self.ssn.sender("test-link")
+    rcv = ssn2.receiver("test-link")
+    assert snd.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_UNINIT
+    assert rcv.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_UNINIT
+
+    snd.open()
+    rcv.open()
+    self.pump()
+
+    assert snd.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+    assert rcv.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+
+
 class LinkTest(Test):
 
   def setup(self):


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

Reply via email to