example.feature 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. Feature: Example feature
  2. This is an example Feature set. Is is mainly intended to show
  3. our use of the lettuce tool and our own framework for it
  4. The first scenario is to show what a simple test would look like, and
  5. is intentionally uncommented.
  6. The later scenarios have comments to show what the test steps do and
  7. support
  8. Scenario: A simple example
  9. Given I have bind10 running with configuration example.org.config
  10. And wait for bind10 stderr message BIND10_STARTED_CC
  11. And wait for bind10 stderr message CMDCTL_STARTED
  12. And wait for bind10 stderr message AUTH_SERVER_STARTED
  13. bind10 module Auth should be running
  14. And bind10 module Resolver should not be running
  15. And bind10 module Xfrout should not be running
  16. And bind10 module Zonemgr should not be running
  17. And bind10 module Xfrin should not be running
  18. And bind10 module Stats should not be running
  19. And bind10 module StatsHttpd should not be running
  20. A query for www.example.org should have rcode NOERROR
  21. A query for www.doesnotexist.org should have rcode REFUSED
  22. The SOA serial for example.org should be 1234
  23. Scenario: New database
  24. # This test checks whether a database file is automatically created
  25. # Underwater, we take advantage of our initialization routines so
  26. # that we are sure this file does not exist, see
  27. # features/terrain/terrain.py
  28. # Standard check to test (non-)existence of a file.
  29. # This file is actually automatically created.
  30. The file data/test_nonexistent_db.sqlite3 should not exist
  31. # In the first scenario, we used 'given I have bind10 running', which
  32. # is actually a compound step consisting of the following two
  33. # one to start the server
  34. When I start bind10 with configuration no_db_file.config
  35. And wait for bind10 stderr message BIND10_STARTED_CC
  36. And wait for bind10 stderr message CMDCTL_STARTED
  37. And wait for bind10 stderr message AUTH_SERVER_STARTED
  38. # Now we use the first step again to see if the file has been created
  39. The file data/test_nonexistent_db.sqlite3 should exist
  40. bind10 module Auth should be running
  41. And bind10 module Resolver should not be running
  42. And bind10 module Xfrout should not be running
  43. And bind10 module Zonemgr should not be running
  44. And bind10 module Xfrin should not be running
  45. And bind10 module Stats should not be running
  46. And bind10 module StatsHttpd should not be running
  47. # This is a general step to stop a named process. By convention,
  48. # the default name for any process is the same as the one we
  49. # use in the start step (for bind 10, that is 'I start bind10 with')
  50. # See scenario 'Multiple instances' for more.
  51. Then stop process bind10
  52. Scenario: example.org queries
  53. # This scenario performs a number of queries and inspects the results
  54. # Simple queries have already been show, but after we have sent a query,
  55. # we can also do more extensive checks on the result.
  56. # See querying.py for more information on these steps.
  57. # note: lettuce can group similar checks by using tables, but we
  58. # intentionally do not make use of that here
  59. # This is a compound statement that starts and waits for the
  60. # started message
  61. Given I have bind10 running with configuration example.org.config
  62. And wait for bind10 stderr message BIND10_STARTED_CC
  63. And wait for bind10 stderr message CMDCTL_STARTED
  64. And wait for bind10 stderr message AUTH_SERVER_STARTED
  65. bind10 module Auth should be running
  66. And bind10 module Resolver should not be running
  67. And bind10 module Xfrout should not be running
  68. And bind10 module Zonemgr should not be running
  69. And bind10 module Xfrin should not be running
  70. And bind10 module Stats should not be running
  71. And bind10 module StatsHttpd should not be running
  72. # Some simple queries that is not examined further
  73. A query for www.example.com should have rcode REFUSED
  74. A query for www.example.org should have rcode NOERROR
  75. # A query where we look at some of the result properties
  76. A query for www.example.org should have rcode NOERROR
  77. The last query response should have qdcount 1
  78. The last query response should have ancount 1
  79. The last query response should have nscount 3
  80. The last query response should have adcount 0
  81. # The answer section can be inspected in its entirety; in the future
  82. # we may add more granular inspection steps
  83. The answer section of the last query response should be
  84. """
  85. www.example.org. 3600 IN A 192.0.2.1
  86. """
  87. A query for example.org type NS should have rcode NOERROR
  88. The answer section of the last query response should be
  89. """
  90. example.org. 3600 IN NS ns1.example.org.
  91. example.org. 3600 IN NS ns2.example.org.
  92. example.org. 3600 IN NS ns3.example.org.
  93. """
  94. # We have a specific step for checking SOA serial numbers
  95. The SOA serial for example.org should be 1234
  96. # Another query where we look at some of the result properties
  97. A query for doesnotexist.example.org should have rcode NXDOMAIN
  98. The last query response should have qdcount 1
  99. The last query response should have ancount 0
  100. The last query response should have nscount 1
  101. The last query response should have adcount 0
  102. # When checking flags, we must pass them exactly as they appear in
  103. # the output of dig.
  104. The last query response should have flags qr aa
  105. A query for www.example.org type TXT should have rcode NOERROR
  106. The last query response should have ancount 0
  107. # Some queries where we specify more details about what to send and
  108. # where
  109. A query for www.example.org class CH should have rcode REFUSED
  110. A query for www.example.org to 127.0.0.1 should have rcode NOERROR
  111. A query for www.example.org to 127.0.0.1:47806 should have rcode NOERROR
  112. A query for www.example.org type A class IN to 127.0.0.1:47806 should have rcode NOERROR
  113. Scenario: example.org mixed-case query
  114. # This scenario performs a mixed-case query and checks that the
  115. # response has the name copied from the question exactly
  116. # (without any change in case). For why this is necessary, see
  117. # section 5.2 of:
  118. # http://tools.ietf.org/html/draft-vixie-dnsext-dns0x20-00
  119. Given I have bind10 running with configuration example.org.config
  120. And wait for bind10 stderr message BIND10_STARTED_CC
  121. And wait for bind10 stderr message CMDCTL_STARTED
  122. And wait for bind10 stderr message AUTH_SERVER_STARTED
  123. bind10 module Auth should be running
  124. And bind10 module Resolver should not be running
  125. And bind10 module Xfrout should not be running
  126. And bind10 module Zonemgr should not be running
  127. And bind10 module Xfrin should not be running
  128. And bind10 module Stats should not be running
  129. And bind10 module StatsHttpd should not be running
  130. A query for wWw.eXaMpLe.Org should have rcode NOERROR
  131. The last query response should have qdcount 1
  132. The last query response should have ancount 1
  133. The last query response should have nscount 3
  134. The last query response should have adcount 0
  135. The question section of the last query response should exactly be
  136. """
  137. ;wWw.eXaMpLe.Org. IN A
  138. """
  139. Scenario: changing database
  140. # This scenario contains a lot of 'wait for' steps
  141. # If those are not present, the asynchronous nature of the application
  142. # can cause some of the things we send to be handled out of order;
  143. # for instance auth could still be serving the old zone when we send
  144. # the new query, or already respond from the new database.
  145. # Therefore we wait for specific log messages after each operation
  146. #
  147. # This scenario outlines every single step, and does not use
  148. # 'steps of steps' (e.g. Given I have bind10 running)
  149. # We can do that but as an example this is probably better to learn
  150. # the system
  151. When I start bind10 with configuration example.org.config
  152. And wait for bind10 stderr message BIND10_STARTED_CC
  153. And wait for bind10 stderr message CMDCTL_STARTED
  154. And wait for bind10 stderr message AUTH_SERVER_STARTED
  155. bind10 module Auth should be running
  156. And bind10 module Resolver should not be running
  157. And bind10 module Xfrout should not be running
  158. And bind10 module Zonemgr should not be running
  159. And bind10 module Xfrin should not be running
  160. And bind10 module Stats should not be running
  161. And bind10 module StatsHttpd should not be running
  162. A query for www.example.org should have rcode NOERROR
  163. Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
  164. Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/empty_db.sqlite3"}
  165. # The 'not missing placeholder' check is for #2743
  166. And wait for new bind10 stderr message DATASRC_SQLITE_CONNOPEN not Missing placeholder
  167. A query for www.example.org should have rcode REFUSED
  168. Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
  169. Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/example.org.sqlite3"}
  170. # The 'not missing placeholder' check is for #2743
  171. And wait for new bind10 stderr message DATASRC_SQLITE_CONNOPEN not Missing placeholder
  172. A query for www.example.org should have rcode NOERROR
  173. Scenario: two bind10 instances
  174. # This is more a test of the test system, start 2 bind10's
  175. When I start bind10 with configuration example.org.config as bind10_one
  176. And wait for bind10_one stderr message BIND10_STARTED_CC
  177. And wait for bind10_one stderr message CMDCTL_STARTED
  178. And wait for bind10_one stderr message AUTH_SERVER_STARTED
  179. And I start bind10 with configuration example2.org.config with cmdctl port 47804 as bind10_two
  180. And wait for bind10_two stderr message BIND10_STARTED_CC
  181. And wait for bind10_two stderr message CMDCTL_STARTED
  182. And wait for bind10_two stderr message AUTH_SERVER_STARTED
  183. A query for www.example.org to 127.0.0.1:47806 should have rcode NOERROR
  184. A query for www.example.org to [::1]:47807 should have rcode NOERROR
  185. The SOA serial for example.org should be 1234
  186. The SOA serial for example.org at 127.0.0.1:47806 should be 1234
  187. The SOA serial for example.org at ::1:47807 should be 1234
  188. Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/empty_db.sqlite3"}
  189. And wait for bind10_one stderr message DATASRC_SQLITE_CONNOPEN
  190. A query for www.example.org to 127.0.0.1:47806 should have rcode REFUSED
  191. A query for www.example.org to [::1]:47807 should have rcode NOERROR