[asterisk-commits] mjordan: testsuite/asterisk/trunk r5928 - in /asterisk/trunk/tests/rest_api: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Nov 15 16:33:51 CST 2014
Author: mjordan
Date: Sat Nov 15 16:33:47 2014
New Revision: 5928
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5928
Log:
tests/rest_api: Fix more test issues with ending too quickly
A number of tests were still ending too quickly or looking for events that
occur after a call to stop_reactor. These tests were fixed in a variety of
ways:
* Some, where it made sense, simply stopped looking for StasisEnd. In
particular, tests that simply use a channel to trigger the start of
processing on completely unrelated activities stopped looking for the
event - it isn't germane to what they test.
* Some chose to tell the underlying test object to not stop the test and
instead stop the tests themselves.
Note that for the channels/playback/to_channel_in_bridge tests, default
extensions.conf files were also added. A lack of extensions.conf relies on
dubious 'make samples' behaviour.
Added:
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf (with props)
Modified:
asterisk/trunk/tests/rest_api/applications/subscribe-channel/subscribe_channel.py
asterisk/trunk/tests/rest_api/applications/subscribe-channel/test-config.yaml
asterisk/trunk/tests/rest_api/applications/subscribe-device-state/subscribe_device_state.py
asterisk/trunk/tests/rest_api/applications/subscribe-device-state/test-config.yaml
asterisk/trunk/tests/rest_api/bridges/delete/test-config.yaml
asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py
asterisk/trunk/tests/rest_api/bridges/unhappy/test-config.yaml
asterisk/trunk/tests/rest_api/channels/playback/basic/test-config.yaml
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/test-config.yaml
asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/test-config.yaml
asterisk/trunk/tests/rest_api/device_state/add_invalid/test-config.yaml
asterisk/trunk/tests/rest_api/device_state/add_remove/test-config.yaml
asterisk/trunk/tests/rest_api/device_state/change/test-config.yaml
asterisk/trunk/tests/rest_api/device_state/list/test-config.yaml
asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/recording.py
asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/test-config.yaml
asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/recording.py
asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/test-config.yaml
Modified: asterisk/trunk/tests/rest_api/applications/subscribe-channel/subscribe_channel.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-channel/subscribe_channel.py?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-channel/subscribe_channel.py (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-channel/subscribe_channel.py Sat Nov 15 16:33:47 2014
@@ -37,4 +37,5 @@
def on_state_change(ari, event, test_object):
LOGGER.debug("on_state_change(%r)" % event)
assert TEST.has_ended, "Expected no state changes before StasisEnd"
+ test_object.stop_reactor()
return True
Modified: asterisk/trunk/tests/rest_api/applications/subscribe-channel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-channel/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-channel/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-channel/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -13,6 +13,9 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+
+test-object-config:
+ stop-on-end: False
ari-config:
events:
Modified: asterisk/trunk/tests/rest_api/applications/subscribe-device-state/subscribe_device_state.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-device-state/subscribe_device_state.py?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-device-state/subscribe_device_state.py (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-device-state/subscribe_device_state.py Sat Nov 15 16:33:47 2014
@@ -11,7 +11,7 @@
INITIAL_STATE = 'NOT_INUSE'
CHANGED_STATE = 'INUSE'
-def on_start(ari, event, obj):
+def on_start(ari, event, test_obj):
# add a device state
ari.put(URL, DEVICE, deviceState=INITIAL_STATE)
@@ -32,7 +32,8 @@
ari.delete('channels', event['channel']['id'])
return True
-def on_state_change(ari, event, obj):
+def on_state_change(ari, event, test_obj):
assert event['device_state']['name'] == DEVICE
assert event['device_state']['state'] == CHANGED_STATE
+ test_obj.stop_reactor()
return True
Modified: asterisk/trunk/tests/rest_api/applications/subscribe-device-state/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-device-state/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-device-state/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-device-state/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -12,6 +12,9 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+
+test-object-config:
+ stop-on-end: False
ari-config:
events:
Modified: asterisk/trunk/tests/rest_api/bridges/delete/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/delete/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/delete/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/delete/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -7,10 +7,25 @@
test-modules:
add-test-to-search-path: True
test-object:
+ config-section: test-object-config
typename: ari.AriTestObject
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+ -
+ config-section: ari-test-stopper
+ typename: pluggable_modules.EventActionModule
+
+test-object-config:
+ stop-on-end: False
+
+ari-test-stopper:
+ -
+ ari-events:
+ match:
+ type: StasisEnd
+ application: testsuite
+ stop_test:
ari-config:
apps: testsuite
@@ -45,11 +60,6 @@
callback:
module: bridge_delete
method: on_destroy
- - conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
properties:
minversion: '12.0.0'
Modified: asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py Sat Nov 15 16:33:47 2014
@@ -155,6 +155,8 @@
TEST = BridgeUnhappy()
+END_EVENTS = 0
+
def on_start(ari, event, test_object):
r = TEST.on_start(ari, event)
@@ -164,7 +166,12 @@
def on_end(ari, event, test_object):
+ global END_EVENTS
+
+ END_EVENTS += 1
r = TEST.on_end(ari, event)
if r:
TEST.run_test(ari)
+ if END_EVENTS == 2:
+ test_object.stop_reactor()
return r
Modified: asterisk/trunk/tests/rest_api/bridges/unhappy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/unhappy/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/unhappy/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/unhappy/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -14,6 +14,7 @@
typename: ari.WebSocketEventModule
test-object-config:
+ stop-on-end: False
test-iterations:
- # Spawn two channels for this test
- channel: Local/s at default
Modified: asterisk/trunk/tests/rest_api/channels/playback/basic/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/basic/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/basic/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/playback/basic/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -28,14 +28,25 @@
config-section: test-object-config
typename: ari.AriOriginateTestObject
modules:
- - config-section: ari-config
+ -
+ config-section: ari-config
typename: ari.WebSocketEventModule
+ -
+ config-section: ari-test-stopper
+ typename: pluggable_modules.EventActionModule
test-object-config:
- # using default origination:
- # endpoint: Local/s at default
- # channelId: testsuite-default-id
- # app: testsuite
+ stop-on-end: False
+
+ari-test-stopper:
+ -
+ ari-events:
+ match:
+ type: ChannelDestroyed
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ stop_test:
ari-config:
apps: testsuite
@@ -119,12 +130,4 @@
channel:
id: 'testsuite-default-id$'
count: 1
- -
- conditions:
- match:
- type: ChannelDestroyed
- application: testsuite
- channel:
- id: 'testsuite-default-id$'
- count: 1
Added: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf?view=auto&rev=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf Sat Nov 15 16:33:47 2014
@@ -1,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -31,8 +31,20 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+ -
+ config-section: ari-test-stopper
+ typename: pluggable_modules.EventActionModule
test-object-config:
+ stop-on-end: False
+
+ari-test-stopper:
+ -
+ ari-events:
+ match:
+ type: StasisEnd
+ application: testsuite
+ stop_test:
ari-config:
apps: testsuite
Added: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf?view=auto&rev=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf Sat Nov 15 16:33:47 2014
@@ -1,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/playback/to_channel_in_bridge_hangup/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -30,8 +30,20 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+ -
+ config-section: ari-test-stopper
+ typename: pluggable_modules.EventActionModule
test-object-config:
+ stop-on-end: False
+
+ari-test-stopper:
+ -
+ ari-events:
+ match:
+ type: StasisEnd
+ application: testsuite
+ stop_test:
ari-config:
apps: testsuite
@@ -132,10 +144,3 @@
instance: 1
method: 'delete'
uri: 'bridges/testsuite-bridge'
- -
- conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
-
Modified: asterisk/trunk/tests/rest_api/device_state/add_invalid/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/device_state/add_invalid/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/device_state/add_invalid/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/device_state/add_invalid/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -23,11 +23,6 @@
callback:
module: device_state
method: on_start
- - conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
properties:
minversion: '12.0.0'
Modified: asterisk/trunk/tests/rest_api/device_state/add_remove/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/device_state/add_remove/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/device_state/add_remove/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/device_state/add_remove/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -23,11 +23,6 @@
callback:
module: device_state
method: on_start
- - conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
properties:
minversion: '12.0.0'
Modified: asterisk/trunk/tests/rest_api/device_state/change/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/device_state/change/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/device_state/change/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/device_state/change/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -24,11 +24,6 @@
callback:
module: device_state
method: on_start
- - conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
properties:
minversion: '12.0.0'
Modified: asterisk/trunk/tests/rest_api/device_state/list/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/device_state/list/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/device_state/list/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/device_state/list/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -24,11 +24,7 @@
callback:
module: device_state
method: on_start
- - conditions:
- match:
- type: StasisEnd
- application: testsuite
- count: 1
+
properties:
minversion: '12.0.0'
Modified: asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/recording.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/recording.py?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/recording.py (original)
+++ asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/recording.py Sat Nov 15 16:33:47 2014
@@ -138,3 +138,18 @@
fail_test()
return
return True
+
+
+def on_stasis_end(ari, event, test_object):
+ """Handler for StasisEnd
+
+ End the test
+
+ Keyword Arguments:
+ event The StasisEnd event
+ test_object Our one and only test object
+ """
+ LOGGER.info("Test finished")
+ test_object.stop_reactor()
+ return True
+
Modified: asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/recording/stored/copy/nominal/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -14,6 +14,9 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+
+test-object-config:
+ stop-on-end: False
ari-config:
apps: testsuite
@@ -45,6 +48,9 @@
match:
type: StasisEnd
application: testsuite
+ callback:
+ module: recording
+ method: on_stasis_end
count: 1
properties:
Modified: asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/recording.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/recording.py?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/recording.py (original)
+++ asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/recording.py Sat Nov 15 16:33:47 2014
@@ -140,3 +140,18 @@
fail_test()
return
return True
+
+
+def on_stasis_end(ari, event, test_object):
+ """Handler for StasisEnd
+
+ End the test
+
+ Keyword Arguments:
+ event The StasisEnd event
+ test_object Our one and only test object
+ """
+ LOGGER.info("Test finished")
+ test_object.stop_reactor()
+ return True
+
Modified: asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/test-config.yaml?view=diff&rev=5928&r1=5927&r2=5928
==============================================================================
--- asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/recording/stored/copy/off-nominal/test-config.yaml Sat Nov 15 16:33:47 2014
@@ -17,6 +17,9 @@
modules:
- config-section: ari-config
typename: ari.WebSocketEventModule
+
+test-object-config:
+ stop-on-end: False
ari-config:
apps: testsuite
@@ -48,6 +51,9 @@
match:
type: StasisEnd
application: testsuite
+ callback:
+ module: recording
+ method: on_stasis_end
count: 1
properties:
More information about the asterisk-commits
mailing list