[asterisk-commits] test case.py: Ignore reactor timeout if already stopping. (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 2 09:48:26 CST 2016


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4546 )

Change subject: test_case.py: Ignore reactor timeout if already stopping.
......................................................................


test_case.py: Ignore reactor timeout if already stopping.

Some tests have a hook to fail the test if the reactor times out during a
test as a fail safe.  However, if the reactor timeout happens while the
test is waiting for Asterisk to shutdown then we should simply log the
event but otherwise ignore it.  The test has already completed and it is
waiting for cleanup to happen because of the CLI "core stop gracefully"
command.  That shutdown command can take awhile to complete due to delays
required for things to safely settle down for cleanup.

Increasing the shutdown timeout gives the reactor timeout more time to
fire and potentially erroneously fail a test.  At this point in a test we
are already shutting down Asterisk.  The shutdown timeout will forcibly
kill Asterisk when it fires.

ASTERISK-26527

Change-Id: Ida565f6151d396821db8770382b6624aec16558e
---
M lib/python/asterisk/test_case.py
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Scott Griepentrog: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/lib/python/asterisk/test_case.py b/lib/python/asterisk/test_case.py
index 11fa3e9..6764749 100644
--- a/lib/python/asterisk/test_case.py
+++ b/lib/python/asterisk/test_case.py
@@ -505,9 +505,13 @@
         """A wrapper function for stop_reactor(), so we know when a reactor
         timeout has occurred.
         """
-        LOGGER.warning("Reactor timeout: '%s' seconds" % self.reactor_timeout)
-        self.on_reactor_timeout()
-        self.stop_reactor()
+        if not self._stopping:
+            LOGGER.warning("Reactor timeout: '%s' seconds" % self.reactor_timeout)
+            self.on_reactor_timeout()
+            self.stop_reactor()
+        else:
+            LOGGER.info("Reactor timeout: '%s' seconds (ignored; already stopping)"
+                        % self.reactor_timeout)
 
     def on_reactor_timeout(self):
         """Virtual method called when reactor times out"""

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ida565f6151d396821db8770382b6624aec16558e
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-commits mailing list