<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7742">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Jenkins2: Verified
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rest_api/applications/subscribe-all: Add delay to shutdown.<br><br>This should hopefully stop the test from randomly failing. I ran the<br>test 100 times each with different delays. The test failed 15 times<br>when run without any delay, 4 times when run with 2 second delay, no<br>failures when run with a 3 second delay.<br><br>I realize this is not ideal but until someone finds a better solution<br>this is better than nothing.<br><br>Change-Id: Ic0faccc5443a3ca800d887e3169a3336634d60c7<br>---<br>M lib/python/asterisk/pluggable_modules.py<br>M tests/rest_api/applications/subscribe-all/test-config.yaml<br>2 files changed, 10 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/lib/python/asterisk/pluggable_modules.py b/lib/python/asterisk/pluggable_modules.py<br>index 785874f..256d222 100755<br>--- a/lib/python/asterisk/pluggable_modules.py<br>+++ b/lib/python/asterisk/pluggable_modules.py<br>@@ -250,6 +250,9 @@<br> def __init__(self, instance_config, test_object):<br> """Constructor"""<br> super(ARIHangupMonitor, self).__init__()<br>+ self.delay = 0<br>+ if 'delay-stop' in instance_config:<br>+ self.delay = instance_config['delay-stop']<br> self.test_object = test_object<br> self.test_object.register_ari_observer(self._handle_ws_open)<br> self.test_object.register_ws_event_handler(self._handle_ws_event)<br>@@ -273,8 +276,9 @@<br> LOGGER.info('Destroyed channel %s', message.get('channel'))<br> self.channels -= 1<br> if (self.channels == 0):<br>- LOGGER.info("All channels have hungup; stopping test")<br>- self.test_object.stop_reactor()<br>+ LOGGER.info("All channels have hungup; stopping test after %d seconds",<br>+ self.delay)<br>+ reactor.callLater(self.delay, self.test_object.stop_reactor)<br> <br> <br> class HangupMonitor(object):<br>diff --git a/tests/rest_api/applications/subscribe-all/test-config.yaml b/tests/rest_api/applications/subscribe-all/test-config.yaml<br>index 334c7fa..e142ffc 100644<br>--- a/tests/rest_api/applications/subscribe-all/test-config.yaml<br>+++ b/tests/rest_api/applications/subscribe-all/test-config.yaml<br>@@ -16,6 +16,10 @@<br> typename: pluggable_modules.EventActionModule<br> -<br> typename: pluggable_modules.ARIHangupMonitor<br>+ config-section: hangup-monitor<br>+<br>+hangup-monitor:<br>+ delay-stop: 3<br> <br> pluggable-config:<br> -<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7742">change 7742</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7742"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ic0faccc5443a3ca800d887e3169a3336634d60c7 </div>
<div style="display:none"> Gerrit-Change-Number: 7742 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>