Browse Source

[2157] update lettuce feature

Yoshitaka Aharen 12 years ago
parent
commit
db2a410da1

+ 3 - 0
tests/lettuce/configurations/example.org.inmem.config

@@ -26,9 +26,12 @@
             ]
         }
     },
+    "Stats": {
+    },
     "Boss": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
+            "b10-stats": { "address": "Stats", "kind": "dispensable" },
             "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
         }
     }

+ 498 - 3
tests/lettuce/features/queries.feature

@@ -8,15 +8,59 @@ Feature: Querying feature
         And wait for bind10 stderr message BIND10_STARTED_CC
         And wait for bind10 stderr message CMDCTL_STARTED
         And wait for bind10 stderr message AUTH_SERVER_STARTED
+        And wait for bind10 stderr message STATS_STARTING
 
         bind10 module Auth should be running
+        And bind10 module Stats should be running
         And bind10 module Resolver should not be running
         And bind10 module Xfrout should not be running
         And bind10 module Zonemgr should not be running
         And bind10 module Xfrin should not be running
-        And bind10 module Stats should not be running
         And bind10 module StatsHttpd should not be running
 
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 0
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         A query for www.example.org should have rcode NOERROR
         The last query response should have flags qr aa rd
         The last query response should have ancount 1
@@ -38,6 +82,53 @@ Feature: Querying feature
         ns2.example.org.        3600    IN      A       192.0.2.4
         """
 
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 1
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 1
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 1
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 1
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 1
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
+
         # Repeat of the above
         A query for www.example.org should have rcode NOERROR
         The last query response should have flags qr aa rd
@@ -60,6 +151,52 @@ Feature: Querying feature
         ns2.example.org.        3600    IN      A       192.0.2.4
         """
 
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 2
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 2
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 2
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 2
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 2
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 2
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 2
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         # And now query something completely different
         A query for nosuchname.example.org should have rcode NXDOMAIN
         The last query response should have flags qr aa rd
@@ -71,6 +208,52 @@ Feature: Querying feature
         example.org.            3600    IN      SOA     ns1.example.org. admin.example.org. 1234 3600 1800 2419200 7200
         """
 
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 3
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 3
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 3
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 3
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 2
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 3
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 2
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 1
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
     Scenario: ANY query
         Given I have bind10 running with configuration example.org.inmem.config
         And wait for bind10 stderr message BIND10_STARTED_CC
@@ -78,13 +261,56 @@ Feature: Querying feature
         And wait for bind10 stderr message AUTH_SERVER_STARTED
 
         bind10 module Auth should be running
+        And bind10 module Stats should be running
         And bind10 module Resolver should not be running
         And bind10 module Xfrout should not be running
         And bind10 module Zonemgr should not be running
         And bind10 module Xfrin should not be running
-        And bind10 module Stats should not be running
         And bind10 module StatsHttpd should not be running
 
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 0
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         A query for example.org type ANY should have rcode NOERROR
         The last query response should have flags qr aa rd
         The last query response should have ancount 4
@@ -104,11 +330,101 @@ Feature: Querying feature
         mail.example.org.       3600    IN      A       192.0.2.10
         """
 
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 1
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 1
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 1
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 1
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 1
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
     Scenario: Delegation query for unsigned child zone
         Given I have bind10 running with configuration example.org.inmem.config
         And wait for bind10 stderr message BIND10_STARTED_CC
         And wait for bind10 stderr message CMDCTL_STARTED
         And wait for bind10 stderr message AUTH_SERVER_STARTED
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 0
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         A dnssec query for www.sub.example.org type AAAA should have rcode NOERROR
         The last query response should have flags qr rd
         The last query response should have edns_flags do
@@ -124,6 +440,52 @@ Feature: Querying feature
         ns.sub.example.org.	3600	IN	A	192.0.2.101
         """
 
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 1
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 1
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 1
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 1
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 1
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 1
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
     Scenario: SSHFP query
         # We are testing one more RR type for a normal successful case
         Given I have bind10 running with configuration example.org.inmem.config
@@ -132,18 +494,151 @@ Feature: Querying feature
         And wait for bind10 stderr message AUTH_SERVER_STARTED
 
         bind10 module Auth should be running
+        And bind10 module Stats should be running
         And bind10 module Resolver should not be running
         And bind10 module Xfrout should not be running
         And bind10 module Zonemgr should not be running
         And bind10 module Xfrin should not be running
-        And bind10 module Stats should not be running
         And bind10 module StatsHttpd should not be running
 
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 0
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 0
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         A query for example.org type SSHFP should have rcode NOERROR
         The last query response should have ancount 0
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 1
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 1
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 1
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 0
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 1
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 1
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 1
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0
+
         A query for shell.example.org type SSHFP should have rcode NOERROR
         The last query response should have ancount 1
         The answer section of the last query response should be
         """
         shell.example.org.      3600    IN      SSHFP   2 1 123456789abcdef67890123456789abcdef67890
         """
+
+        And wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+        And wait for new bind10 stderr message AUTH_RECEIVED_COMMAND
+
+        When I query statistics zones of bind10 module Auth
+        last bindctl output should not contain "error"
+        Then the statistics counter v4 in the category request for the zone _SERVER_ should be 2
+        Then the statistics counter v6 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter udp in the category request for the zone _SERVER_ should be 2
+        Then the statistics counter tcp in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badednsver in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter badsig in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter dnssec_ok in the category request for the zone _SERVER_ should be 0
+        Then the statistics counter query in the category opcode for the zone _SERVER_ should be 2
+        Then the statistics counter iquery in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter status in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter notify in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter update in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category opcode for the zone _SERVER_ should be 0
+        Then the statistics counter responses for the zone _SERVER_ should be 2
+        Then the statistics counter truncated in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter edns0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter tsig in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter sig0 in the category response for the zone _SERVER_ should be 0
+        Then the statistics counter qrysuccess for the zone _SERVER_ should be 1
+        Then the statistics counter qryauthans for the zone _SERVER_ should be 2
+        Then the statistics counter qrynoauthans for the zone _SERVER_ should be 0
+        Then the statistics counter qryreferral for the zone _SERVER_ should be 0
+        Then the statistics counter qrynxrrset for the zone _SERVER_ should be 1
+        Then the statistics counter authqryrej for the zone _SERVER_ should be 0
+        Then the statistics counter noerror in the category rcode for the zone _SERVER_ should be 2
+        Then the statistics counter formerr in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter servfail in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notimp in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter refused in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxdomain in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter yxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter nxrrset in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notauth in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter notzone in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter badvers in the category rcode for the zone _SERVER_ should be 0
+        Then the statistics counter other in the category rcode for the zone _SERVER_ should be 0

+ 14 - 4
tests/lettuce/features/terrain/bind10_control.py

@@ -391,14 +391,16 @@ def find_value(dictionary, key):
         for v in dictionary.values():
             return find_value(v, key)
 
-@step('the statistics counter (\S+)(?: for the zone (\S+))? should be' + \
+@step('the statistics counter (\S+)(?: in the category (\S+))?'+ \
+          '(?: for the zone (\S+))? should be' + \
           '(?:( greater than| less than| between))? (\-?\d+)(?: and (\-?\d+))?')
-def check_statistics(step, counter, zone, gtltbt, number, upper):
+def check_statistics(step, counter, category, zone, gtltbt, number, upper):
     """
     check the output of bindctl for statistics of specified counter
     and zone.
     Parameters:
     counter ('counter <counter>'): The counter name of statistics.
+    category ('category <category>', optional): The category of counter.
     zone ('zone <zone>', optional): The zone name.
     gtltbt (' greater than'|' less than'|' between', optional): greater than
           <number> or less than <number> or between <number> and <upper>.
@@ -409,14 +411,22 @@ def check_statistics(step, counter, zone, gtltbt, number, upper):
     """
     output = parse_bindctl_output_as_data_structure()
     found = None
+    category_str = ""
     zone_str = ""
+    depth = []
+    if category:
+        depth.insert(0, category)
+        category_str = " for category %s" % category
     if zone:
-        found = find_value(find_value(output, zone), counter)
+        depth.insert(0, zone)
         zone_str = " for zone %s" % zone
+    for level in depth:
+        output = find_value(output, level)
     else:
         found = find_value(output, counter)
     assert found is not None, \
-        'Not found statistics counter %s%s' % (counter, zone_str)
+        'Not found statistics counter %s%s%s' % \
+            (counter, category_str, zone_str)
     msg = "Got %s, expected%s %s as counter %s%s" % \
         (found, gtltbt, number, counter, zone_str)
     if gtltbt and 'between' in gtltbt and upper: