[asterisk-dev] [Code Review] 3383: TestSuite: Fix bouncing show_subscriptions test
opticron
reviewboard at asterisk.org
Mon Mar 24 12:44:33 CDT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3383/
-----------------------------------------------------------
Review request for Asterisk Developers.
Repository: testsuite
Description
-------
This fixes a race condition in the tests/channels/pjsip/ami/show_subscriptions test where the PJSIPShowSubscriptionsInbound AMI command would be issued before states had finished transitioning resulting in the response containing "NULL" instead of "ACTIVE". This also requires the following patch that adds a test event when Asterisk is compiled in development mode:
Index: res/res_pjsip_pubsub.c
===================================================================
--- res/res_pjsip_pubsub.c (revision 410980)
+++ res/res_pjsip_pubsub.c (working copy)
@@ -42,6 +42,7 @@
#include "asterisk/res_pjsip.h"
#include "asterisk/callerid.h"
#include "asterisk/manager.h"
+#include "asterisk/test.h"
#include "res_pjsip/include/res_pjsip_private.h"
/*** DOCUMENTATION
@@ -464,8 +465,18 @@
int ast_sip_subscription_send_request(struct ast_sip_subscription *sub, pjsip_tx_data *tdata)
{
- return pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub),
+ struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sub);
+ int res = pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub),
tdata) == PJ_SUCCESS ? 0 : -1;
+
+ ast_test_suite_event_notify("SUBSCRIPTION_STATE_SET",
+ "StateText: %s\r\n"
+ "Endpoint: %s\r\n",
+ pjsip_evsub_get_state_name(ast_sip_subscription_get_evsub(sub)),
+ ast_sorcery_object_get_id(endpoint));
+
+ ao2_cleanup(endpoint);
+ return res;
}
static void subscription_datastore_destroy(void *obj)
Diffs
-----
asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py 4885
Diff: https://reviewboard.asterisk.org/r/3383/diff/
Testing
-------
Verified that the race was resolved by using state transition test events instead of the successful callback of the SIPp scenario.
Thanks,
opticron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140324/74fb1cdd/attachment.html>
More information about the asterisk-dev
mailing list