[Asterisk-code-review] lib/python/mockd: Add support for a stats prefix (testsuite[master])
Matt Jordan
asteriskteam at digium.com
Mon Nov 23 09:21:36 CST 2015
Matt Jordan has uploaded a new change for review.
https://gerrit.asterisk.org/1697
Change subject: lib/python/mockd: Add support for a stats prefix
......................................................................
lib/python/mockd: Add support for a stats prefix
Because multiple modules may be sending statistics during a test, this patch
adds a 'prefix' value to the module configuration. If a received stat does
not start with the 'prefix' value, it is ignored.
Change-Id: I4f1fdbc05bfd719d83b4388f21213aaf0c167215
---
M lib/python/mockd.py
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/97/1697/1
diff --git a/lib/python/mockd.py b/lib/python/mockd.py
index 24e76c9..3d4299b 100644
--- a/lib/python/mockd.py
+++ b/lib/python/mockd.py
@@ -56,7 +56,10 @@
self.config = config
self.test_object = test_object
self.packets = []
+ self.prefix = self.config.get('prefix')
+
self.test_object.register_stop_observer(self._stop_handler)
+
reactor.listenUDP(8125, MockDProtocol(self))
def message_handler(self, message):
@@ -67,6 +70,8 @@
Check the message against the config and pass the test if they match
'''
+ if self.prefix and not message.startswith(self.prefix):
+ return
self.packets.append(message)
def _stop_handler(self, result):
--
To view, visit https://gerrit.asterisk.org/1697
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f1fdbc05bfd719d83b4388f21213aaf0c167215
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list