[Asterisk-code-review] rest api/applications/subscribe-all: Add delay to shutdown. (testsuite[master])
George Joseph
asteriskteam at digium.com
Fri Dec 29 12:43:37 CST 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/7742 )
Change subject: rest_api/applications/subscribe-all: Add delay to shutdown.
......................................................................
rest_api/applications/subscribe-all: Add delay to shutdown.
This should hopefully stop the test from randomly failing. I ran the
test 100 times each with different delays. The test failed 15 times
when run without any delay, 4 times when run with 2 second delay, no
failures when run with a 3 second delay.
I realize this is not ideal but until someone finds a better solution
this is better than nothing.
Change-Id: Ic0faccc5443a3ca800d887e3169a3336634d60c7
---
M lib/python/asterisk/pluggable_modules.py
M tests/rest_api/applications/subscribe-all/test-config.yaml
2 files changed, 10 insertions(+), 2 deletions(-)
Approvals:
Jenkins2: Verified
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/lib/python/asterisk/pluggable_modules.py b/lib/python/asterisk/pluggable_modules.py
index 785874f..256d222 100755
--- a/lib/python/asterisk/pluggable_modules.py
+++ b/lib/python/asterisk/pluggable_modules.py
@@ -250,6 +250,9 @@
def __init__(self, instance_config, test_object):
"""Constructor"""
super(ARIHangupMonitor, self).__init__()
+ self.delay = 0
+ if 'delay-stop' in instance_config:
+ self.delay = instance_config['delay-stop']
self.test_object = test_object
self.test_object.register_ari_observer(self._handle_ws_open)
self.test_object.register_ws_event_handler(self._handle_ws_event)
@@ -273,8 +276,9 @@
LOGGER.info('Destroyed channel %s', message.get('channel'))
self.channels -= 1
if (self.channels == 0):
- LOGGER.info("All channels have hungup; stopping test")
- self.test_object.stop_reactor()
+ LOGGER.info("All channels have hungup; stopping test after %d seconds",
+ self.delay)
+ reactor.callLater(self.delay, self.test_object.stop_reactor)
class HangupMonitor(object):
diff --git a/tests/rest_api/applications/subscribe-all/test-config.yaml b/tests/rest_api/applications/subscribe-all/test-config.yaml
index 334c7fa..e142ffc 100644
--- a/tests/rest_api/applications/subscribe-all/test-config.yaml
+++ b/tests/rest_api/applications/subscribe-all/test-config.yaml
@@ -16,6 +16,10 @@
typename: pluggable_modules.EventActionModule
-
typename: pluggable_modules.ARIHangupMonitor
+ config-section: hangup-monitor
+
+hangup-monitor:
+ delay-stop: 3
pluggable-config:
-
--
To view, visit https://gerrit.asterisk.org/7742
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0faccc5443a3ca800d887e3169a3336634d60c7
Gerrit-Change-Number: 7742
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171229/0c6aac5b/attachment.html>
More information about the asterisk-code-review
mailing list