[Asterisk-code-review] Testsuite: tests/channels/SIP/tcpauthlimit/tcp client scenar... (testsuite[master])

Ashley Sanders asteriskteam at digium.com
Mon Sep 28 17:04:55 CDT 2015


Ashley Sanders has uploaded a new change for review.

  https://gerrit.asterisk.org/1336

Change subject: Testsuite: tests/channels/SIP/tcpauthlimit/tcp_client_scenario is Failing
......................................................................

Testsuite: tests/channels/SIP/tcpauthlimit/tcp_client_scenario is Failing

While this does not actually correct the issue with the intermittent
failures, this patch modifies a log message such that it matches the
formatting of the other log messages (to help with debugging) and
also changes the use of LineReceiver.transport.loseConnection to
LineReceiver.transport.abortConnection. Reviewing the test logs
revealed that not all of the transports were being destroyed after a
test case executed. After reading the Twisted documentation closer,
it appears that LineReceiver.transport.loseConnection will have no
effect under certain circumnstances. So, in situations where you do
not need to take advantage of the safeguards provided by:
LineReceiver.transport.loseConnection, the method to use is:
LineReceiver.transport.abortConnection.

http://twistedmatrix.com/documents/current/core/howto/servers.html#
loseconnection-and-abortconnection

ASTERISK-25432
Reported By: Ashley Sanders

Change-Id: I8f6d448fb15f43245644c1c9c416dffe47944a15
---
M tests/channels/SIP/tcpauthlimit/tcp_scenario.py
1 file changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/36/1336/1

diff --git a/tests/channels/SIP/tcpauthlimit/tcp_scenario.py b/tests/channels/SIP/tcpauthlimit/tcp_scenario.py
index 603ddc3..11e313d 100644
--- a/tests/channels/SIP/tcpauthlimit/tcp_scenario.py
+++ b/tests/channels/SIP/tcpauthlimit/tcp_scenario.py
@@ -95,17 +95,15 @@
         msg = '{0} Initial connection to {1} established.'
         LOGGER.debug(msg.format(self, self.host))
 
-        connection_state = self.__sync_socket()
-        if connection_state != ConnectionState.CONNECTED:
-            msg = '{0} Connection state to {1} : {2}'
-            state = ConnectionState.get_state_name(connection_state)
-            LOGGER.debug(msg.format(self, self.host, state))
-            self.disconnect()
-        else:
-            msg = '{0} Connection to {1} successful.'
-            LOGGER.debug(msg.format(self, self.host))
+        self.__connection_state = self.__sync_socket()
 
-        self.__connection_state = connection_state
+        msg = '{0} Connection state to {1} : {2}'
+        state = ConnectionState.get_state_name(self.__connection_state)
+        LOGGER.debug(msg.format(self, self.host, state))
+
+        if self.__connection_state != ConnectionState.CONNECTED:
+            self.disconnect()
+
         self.__on_connection_change()
 
     def disconnect(self):
@@ -116,7 +114,7 @@
 
         msg = '{0} Disconnecting the transport...'.format(self)
         LOGGER.debug(msg)
-        self.transport.loseConnection()
+        self.transport.abortConnection()
 
     def fail_connection(self):
         """Fails the connection.

-- 
To view, visit https://gerrit.asterisk.org/1336
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f6d448fb15f43245644c1c9c416dffe47944a15
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Ashley Sanders <asanders at digium.com>



More information about the asterisk-code-review mailing list