[Asterisk-code-review] lib/python/mockd: Add support for a stats prefix (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Tue Nov 24 08:30:31 CST 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

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(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



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: merged
Gerrit-Change-Id: I4f1fdbc05bfd719d83b4388f21213aaf0c167215
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list