[Asterisk-code-review] apps/statsd: Update tests to use new condition based matching (testsuite[master])

Kevin Harwell asteriskteam at digium.com
Fri Jun 22 13:37:04 CDT 2018


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/9284


Change subject: apps/statsd: Update tests to use new condition based matching
......................................................................

apps/statsd: Update tests to use new condition based matching

The apps/statsd tests were written in a way that did not allow for flexible
message matching. A previous patch added condition based message handling and
matching routines that allow greater flexibility in matching messages.

This patch updates the apps/statsd tests to take advantage of that.

Change-Id: I36de44a6dd508ba11b8f70a146592b0cbe814638
---
M tests/apps/statsd/nominal/test-config.yaml
M tests/apps/statsd/off-nominal/empty_params/test-config.yaml
M tests/apps/statsd/off-nominal/invalid_metric/test-config.yaml
M tests/apps/statsd/off-nominal/invalid_sample_rate/test-config.yaml
M tests/apps/statsd/off-nominal/invalid_value/test-config.yaml
M tests/apps/statsd/off-nominal/invalid_variable/test-config.yaml
M tests/apps/statsd/off-nominal/no_metric/test-config.yaml
M tests/apps/statsd/off-nominal/no_value/test-config.yaml
M tests/apps/statsd/off-nominal/no_variable/test-config.yaml
9 files changed, 86 insertions(+), 61 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/84/9284/1

diff --git a/tests/apps/statsd/nominal/test-config.yaml b/tests/apps/statsd/nominal/test-config.yaml
index 81d7b04..14f2969 100644
--- a/tests/apps/statsd/nominal/test-config.yaml
+++ b/tests/apps/statsd/nominal/test-config.yaml
@@ -12,8 +12,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -23,17 +23,18 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    prefix: nominal
-    packets:
-        -
-            'nominal.foo:1|g'
-        -
-            'nominal.bar:2|s'
-        -
-            'nominal.baz:3|ms'
-        -
-            'nominal.last:4|c'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                'nominal.foo:1|g'
+            -
+                'nominal.bar:2|s'
+            -
+                'nominal.baz:3|ms'
+            -
+                'nominal.last:4|c'
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/empty_params/test-config.yaml b/tests/apps/statsd/off-nominal/empty_params/test-config.yaml
index 2934e56..2411a11 100644
--- a/tests/apps/statsd/off-nominal/empty_params/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/empty_params/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/invalid_metric/test-config.yaml b/tests/apps/statsd/off-nominal/invalid_metric/test-config.yaml
index 822fd78..136a050 100644
--- a/tests/apps/statsd/off-nominal/invalid_metric/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/invalid_metric/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/invalid_sample_rate/test-config.yaml b/tests/apps/statsd/off-nominal/invalid_sample_rate/test-config.yaml
index 1978a4c..8a984c1 100644
--- a/tests/apps/statsd/off-nominal/invalid_sample_rate/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/invalid_sample_rate/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/invalid_value/test-config.yaml b/tests/apps/statsd/off-nominal/invalid_value/test-config.yaml
index 6124f37..665d6c5 100644
--- a/tests/apps/statsd/off-nominal/invalid_value/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/invalid_value/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/invalid_variable/test-config.yaml b/tests/apps/statsd/off-nominal/invalid_variable/test-config.yaml
index 16da613..ef8bc27 100644
--- a/tests/apps/statsd/off-nominal/invalid_variable/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/invalid_variable/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/no_metric/test-config.yaml b/tests/apps/statsd/off-nominal/no_metric/test-config.yaml
index 8b5692e..acc3109 100644
--- a/tests/apps/statsd/off-nominal/no_metric/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/no_metric/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/no_value/test-config.yaml b/tests/apps/statsd/off-nominal/no_value/test-config.yaml
index ad8f1e2..cf848d5 100644
--- a/tests/apps/statsd/off-nominal/no_value/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/no_value/test-config.yaml
@@ -11,8 +11,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -22,10 +22,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'
diff --git a/tests/apps/statsd/off-nominal/no_variable/test-config.yaml b/tests/apps/statsd/off-nominal/no_variable/test-config.yaml
index 9b6053e..9d4f5fc 100644
--- a/tests/apps/statsd/off-nominal/no_variable/test-config.yaml
+++ b/tests/apps/statsd/off-nominal/no_variable/test-config.yaml
@@ -13,8 +13,8 @@
         typename: 'test_case.TestCaseModule'
     modules:
         -
-            typename: 'mockd.MockDServer'
-            config-section: 'statsd-config'
+            config-section: event-action-config
+            typename: 'pluggable_modules.EventActionModule'
         -
             typename: 'pluggable_modules.Originator'
             config-section: 'originator-config'
@@ -24,10 +24,13 @@
     connect-ami: True
     reactor-timeout: 15
 
-statsd-config:
-    packets:
-        -
-            'ReceiveNothing'
+event-action-config:
+    event:
+        type: 'matcher_listener.Udp'
+        conditions:
+            -
+                match: '.*'
+                count: 0
 
 originator-config:
     channel: 'Local/start at default'

-- 
To view, visit https://gerrit.asterisk.org/9284
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36de44a6dd508ba11b8f70a146592b0cbe814638
Gerrit-Change-Number: 9284
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180622/71d2238f/attachment-0001.html>


More information about the asterisk-code-review mailing list