[svn-commits] mjordan: trunk r419319 - in /trunk: ./ main/ tests/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 23 11:46:15 CDT 2014


Author: mjordan
Date: Wed Jul 23 11:46:13 2014
New Revision: 419319

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=419319
Log:
endpoints: Fix failing unit tests from r419196

This patch does two things:
(1) It updates the unit tests to expect additional stasis messages. More
    messages are now sent to the endpoint topic, due to forwarding all
    channel messages and the forwarding relationship set up between
    endpoints themselves.
(2) Remove the technology forwarding subscription during
    ast_endpoint_shutdown. This prevents an improper double shutdown of
    an endpoint from occurring.
........

Merged revisions 419318 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/endpoints.c
    trunk/tests/test_stasis_endpoints.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/endpoints.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/endpoints.c?view=diff&rev=419319&r1=419318&r2=419319
==============================================================================
--- trunk/main/endpoints.c (original)
+++ trunk/main/endpoints.c Wed Jul 23 11:46:13 2014
@@ -194,8 +194,6 @@
 	ao2_cleanup(endpoint->router);
 	endpoint->router = NULL;
 
-	endpoint->tech_forward = stasis_forward_cancel(endpoint->tech_forward);
-
 	stasis_cp_single_unsubscribe(endpoint->topics);
 	endpoint->topics = NULL;
 
@@ -368,6 +366,7 @@
 	}
 
 	ao2_unlink(endpoints, endpoint);
+	endpoint->tech_forward = stasis_forward_cancel(endpoint->tech_forward);
 
 	clear_msg = create_endpoint_snapshot_message(endpoint);
 	if (clear_msg) {

Modified: trunk/tests/test_stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_stasis_endpoints.c?view=diff&rev=419319&r1=419318&r2=419319
==============================================================================
--- trunk/tests/test_stasis_endpoints.c (original)
+++ trunk/tests/test_stasis_endpoints.c Wed Jul 23 11:46:13 2014
@@ -168,7 +168,7 @@
 		cache_update, __func__, STASIS_SINK_DEFAULT_WAIT);
 	ast_test_validate(test, 0 <= message_index);
 
-	/* First message should be a cache creation entry for our endpont */
+	/* First message should be a cache creation entry for our endpoint */
 	msg = sink->messages[message_index];
 	type = stasis_message_type(msg);
 	ast_test_validate(test, stasis_cache_update_type() == type);
@@ -182,7 +182,10 @@
 
 	ast_endpoint_shutdown(uut);
 	uut = NULL;
-	message_index = stasis_message_sink_wait_for(sink, message_index + 1,
+
+	/* Note: there's a few messages between the creation and the clear.
+	 * Wait for all of them... */
+	message_index = stasis_message_sink_wait_for(sink, message_index + 4,
 		cache_update, __func__, STASIS_SINK_DEFAULT_WAIT);
 	ast_test_validate(test, 0 <= message_index);
 	/* Now we should have a cache removal entry */
@@ -252,20 +255,28 @@
 	ast_hangup(chan);
 	chan = NULL;
 
-	actual_count = stasis_message_sink_wait_for_count(sink, 4,
+	actual_count = stasis_message_sink_wait_for_count(sink, 6,
 		STASIS_SINK_DEFAULT_WAIT);
-	ast_test_validate(test, 4 == actual_count);
+	ast_test_validate(test, 6 == actual_count);
 
 	msg = sink->messages[1];
 	type = stasis_message_type(msg);
+	ast_test_validate(test, stasis_cache_update_type() == type);
+
+	msg = sink->messages[2];
+	type = stasis_message_type(msg);
 	ast_test_validate(test, ast_channel_snapshot_type() == type);
+
+	msg = sink->messages[3];
+	type = stasis_message_type(msg);
+	ast_test_validate(test, stasis_cache_update_type() == type);
 
 	/* The ordering of the cache clear and endpoint snapshot are
 	 * unspecified */
-	msg = sink->messages[2];
+	msg = sink->messages[4];
 	if (stasis_message_type(msg) == stasis_cache_clear_type()) {
 		/* Okay; the next message should be the endpoint snapshot */
-		msg = sink->messages[3];
+		msg = sink->messages[5];
 	}
 
 	type = stasis_message_type(msg);




More information about the svn-commits mailing list