Browse Source

[2252] add an exceptional case when checking initial statistics of Xfrout

Sometime an unixdomain socket could be already opened at the first
time when stats daemon queries xfrout statistics.
Naoki Kambe 12 years ago
parent
commit
d7885ecddb

+ 10 - 3
tests/lettuce/features/terrain/bind10_control.py

@@ -438,22 +438,29 @@ def check_statistics_items(step, category, has_except_for):
             'Statistics item %s has unexpected value %s (expect %s)' % \
                 (name, found, 0)
 
-@step('check initial statistics(?:( not)? containing (\S+))? for (\S+)( with cmdctl port \d+)?')
-def check_init_statistics(step, notv, string, name, cmdctl_port):
+@step('check initial statistics(?:( not)? containing (\S+))? for (\S+)'
+      '( with cmdctl port \d+)?( except for the following items)?')
+def check_init_statistics(step, notv, string, name, cmdctl_port, has_except_for):
     """Checks the initial statistics for the module. Also checks a
-    string is contained or not contained in them.
+    string is contained or not contained in them. Statistics counters
+      other than zero can follow below.
     Parameters:
     notv ('not'): reverse the check (fail if string is found)
     string ('containing <string>') string to look for
     name ('module <name>'): The name of the module (case sensitive!)
     cmdctl_port ('with cmdctl port <portnr>', optional): cmdctl port to send
                 the command to.
+    has_except_for ('except for the following items'): checks values of items
+        with the multiline part.
     """
     query_str = 'query statistics of bind10 module ' + name
     if cmdctl_port:
         query_str = query_str + cmdctl_port
     notcontain_str = 'last bindctl output should%s contain "%s"'
     check_str = 'statistics counters are 0 in category .' + name
+    if has_except_for:
+        check_str = check_str + has_except_for + "\n" \
+            + step.represent_hashes()
     step.given(query_str)
     step.given(notcontain_str % (' not', 'error'))
     if string is not None:

+ 20 - 4
tests/lettuce/features/xfrin_notify_handling.feature

@@ -27,7 +27,11 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    check initial statistics not containing example.org for Xfrout with cmdctl port 47804
+    check initial statistics not containing example.org for Xfrout with cmdctl port 47804 except for the following items
+      | item_name                | min_value | max_value |
+      | socket.unixdomain.open   |         0 |         1 |
+    # Note: Sometime an unixdomain socket could be already opened at
+    # the first time when stats daemon queries xfrout statistics.
 
     #
     # Test2 for Xfrin statistics
@@ -118,7 +122,11 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    check initial statistics not containing example.org for Xfrout with cmdctl port 47804
+    check initial statistics not containing example.org for Xfrout with cmdctl port 47804 except for the following items
+      | item_name                | min_value | max_value |
+      | socket.unixdomain.open   |         0 |         1 |
+    # Note: Sometime an unixdomain socket could be already opened at
+    # the first time when stats daemon queries xfrout statistics.
     #
     # Test2 for Xfrin statistics
     #
@@ -216,7 +224,11 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    check initial statistics not containing example.org for Xfrout with cmdctl port 47804
+    check initial statistics not containing example.org for Xfrout with cmdctl port 47804 except for the following items
+      | item_name                | min_value | max_value |
+      | socket.unixdomain.open   |         0 |         1 |
+    # Note: Sometime an unixdomain socket could be already opened at
+    # the first time when stats daemon queries xfrout statistics.
 
     #
     # Test2 for Xfrin statistics
@@ -322,7 +334,11 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    check initial statistics not containing example.org for Xfrout with cmdctl port 47804
+    check initial statistics not containing example.org for Xfrout with cmdctl port 47804 except for the following items
+      | item_name                | min_value | max_value |
+      | socket.unixdomain.open   |         0 |         1 |
+    # Note: Sometime an unixdomain socket could be already opened at
+    # the first time when stats daemon queries xfrout statistics.
 
     #
     # Test2 for Xfrin statistics