Browse Source

[2252] unify multiple similar checks of initial statistics into a step method

Naoki Kambe 12 years ago
parent
commit
d69fb646ed

+ 22 - 0
tests/lettuce/features/terrain/bind10_control.py

@@ -432,3 +432,25 @@ def check_statistics_items(step, category, has_except_for):
         assert int(found) == 0, \
             'Statistics item %s has unexpected value %s (expect %s)' % \
                 (name, found, 0)
+
+@step('check initial statistics for (Xfrin|Xfrout)')
+def check_init_statistics(step, module):
+    """
+    check the initial statistics for Xfrin or Xfrout.
+    Parameters:
+    module : Xfrin or Xfrout
+    """
+    query_str = 'When I query statistics %%s of bind10 module %s with cmdctl' % module
+    notcontain_str = 'last bindctl output should not contain "%s"'
+    check_str = 'The statistics counters are 0 in category .%s%%s' % module
+    if module == 'Xfrout':
+        query_str = query_str + ' port 47804'
+    step.given(query_str % 'zones')
+    step.given(notcontain_str % 'error')
+    step.given(notcontain_str % 'example.org.')
+    step.given(check_str % '.zones._SERVER_')
+    if module == 'Xfrout':
+        step.given(query_str % 'ixfr_running')
+        step.given(check_str)
+        step.given(query_str % 'axfr_running')
+        step.given(check_str)

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

@@ -22,19 +22,7 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    # check initial statistics
-    #
-    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
-    last bindctl output should not contain "error"
-    last bindctl output should not contain "example.org."
-    The statistics counters are 0 in category .Xfrout.zones._SERVER_
-
-    When I query statistics ixfr_running of bind10 module Xfrout with cmdctl port 47804
-    The statistics counters are 0 in category .Xfrout
-
-    When I query statistics axfr_running of bind10 module Xfrout with cmdctl port 47804
-    The statistics counters are 0 in category .Xfrout
-
+    check initial statistics for Xfrout
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
     The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
       | item_name | min_value | max_value |
@@ -43,12 +31,7 @@ Feature: Xfrin incoming notify handling
     #
     # Test2 for Xfrin statistics
     #
-    # check initial statistics
-    #
-    When I query statistics zones of bind10 module Xfrin with cmdctl
-    last bindctl output should not contain "error"
-    The statistics counters are 0 in category .Xfrin.zones._SERVER_
-
+    check initial statistics for Xfrin
     When I send bind10 with cmdctl port 47804 the command Xfrout notify example.org IN
     Then wait for new master stderr message XFROUT_NOTIFY_COMMAND
     Then wait for new bind10 stderr message AUTH_RECEIVED_NOTIFY
@@ -135,19 +118,7 @@ Feature: Xfrin incoming notify handling
     #
     # Test5 for Xfrout statistics
     #
-    # check initial statistics
-    #
-    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
-    last bindctl output should not contain "error"
-    last bindctl output should not contain "example.org."
-    The statistics counters are 0 in category .Xfrout.zones._SERVER_
-
-    When I query statistics ixfr_running of bind10 module Xfrout with cmdctl port 47804
-    The statistics counters are 0 in category .Xfrout
-
-    When I query statistics axfr_running of bind10 module Xfrout with cmdctl port 47804
-    The statistics counters are 0 in category .Xfrout
-
+    check initial statistics for Xfrout
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
     The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
       | item_name | min_value | max_value |
@@ -156,12 +127,7 @@ Feature: Xfrin incoming notify handling
     #
     # Test6 for Xfrin statistics
     #
-    # check initial statistics
-    #
-    When I query statistics zones of bind10 module Xfrin with cmdctl
-    last bindctl output should not contain "error"
-    The statistics counters are 0 in category .Xfrin.zones._SERVER_
-
+    check initial statistics for Xfrin
     #
     # set transfer_acl rejection
     # Local xfr requests from Xfrin module would be rejected here.