]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1461] DDNS test set 2
authorJelte Jansen <jelte@isc.org>
Tue, 12 Jun 2012 13:34:17 +0000 (15:34 +0200)
committerJelte Jansen <jelte@isc.org>
Wed, 13 Jun 2012 14:42:15 +0000 (16:42 +0200)
tests/lettuce/features/ddns_system.feature
tests/lettuce/features/terrain/nsupdate.py

index 4e3f41c79bc04a97ba1694b85321c863e1fe5886..a7f58559d99fa485f02166b6309eba1ad0d25745 100644 (file)
@@ -3,12 +3,7 @@ Feature: DDNS System
     'compliance' category; specific ACL checks, module checks, etc.
 
     Scenario: Module tests
-        # This test runs the original example configuration, which has
-        # a number of modules. It then removes all non-essential modules,
-        # and checks whether they do disappear from the list of running
-        # modules (note that it 'misuses' the help command for this,
-        # there is a Boss command 'show_processes' but it's output is
-        # currently less standardized than 'help')
+        # The given config has b10-ddns disabled
         Given I have bind10 running with configuration ddns/noddns.config
         And wait for bind10 stderr message BIND10_STARTED_CC
         And wait for bind10 stderr message AUTH_SERVER_STARTED
@@ -84,3 +79,35 @@ Feature: DDNS System
         The DDNS response should be SERVFAIL
         And the SOA serial for example.org should be 1239
 
+    Scenario: ACL
+        # The given config has b10-ddns disabled
+        Given I have bind10 running with configuration ddns/ddns.config
+        And wait for bind10 stderr message BIND10_STARTED_CC
+        And wait for bind10 stderr message AUTH_SERVER_STARTED
+        And wait for bind10 stderr message DDNS_RUNNING
+
+        # Sanity check
+        A query for new1.example.org should have rcode NXDOMAIN
+        A query for new2.example.org should have rcode NXDOMAIN
+        A query for new3.example.org should have rcode NXDOMAIN
+        The SOA serial for example.org should be 1234
+
+        # Test 1
+        When I use DDNS to add a record new1.example.org. 3600 IN A 192.0.2.1
+        The DDNS response should be SUCCESS
+        A query for new1.example.org should have rcode NOERROR
+        The SOA serial for example.org should be 1235
+
+        # Test 2
+        When I set DDNS ACL 0 for 127.0.0.1 to REJECT
+        Then use DDNS to add a record new2.example.org. 3600 IN A 192.0.2.2
+        The DDNS response should be REFUSED
+        A query for new2.example.org should have rcode NXDOMAIN
+        The SOA serial for example.org should be 1235
+
+        # Test 3
+        When I set DDNS ACL 0 for 127.0.0.1 to ACCEPT
+        Then use DDNS to add a record new3.example.org. 3600 IN A 192.0.2.3
+        The DDNS response should be SUCCESS
+        A query for new3.example.org should have rcode NOERROR
+        The SOA serial for example.org should be 1236
index 8c5fef4c8aeceb8788b408ea332369920260256b..afd2cda493a417c3a3f3ceb2aeeca2d6e1abad14 100644 (file)
@@ -120,16 +120,6 @@ def run_ddns_update(step):
     '''
     run_nsupdate(world.nsupdate_commands)
 
-@step('use DDNS to set the SOA SERIAL to ([0-9]+)')
-def set_serial_to(step, new_serial):
-    '''
-    Convenience compound step; prepare an update for example.org,
-    which sets the SERIAL to the given value
-    '''
-    step.given('Prepare a DDNS update')
-    step.given('add to the DDNS update: update add example.org 3600 IN SOA ns1.example.org. admin.example.org. ' + new_serial + ' 3600 1800 2419200 7200')
-    step.given('Run the DDNS update')
-
 @step('Configure BIND10 to run DDNS')
 def configure_ddns_on(step):
     step.behave_as("""
@@ -152,3 +142,31 @@ def configure_ddns_on(step):
         \"\"\"
     """)
 
+@step('use DDNS to set the SOA SERIAL to ([0-9]+)')
+def set_serial_to(step, new_serial):
+    '''
+    Convenience compound step; prepare an update for example.org,
+    which sets the SERIAL to the given value
+    '''
+    step.given('Prepare a DDNS update')
+    step.given('add to the DDNS update: update add example.org 3600 IN SOA ns1.example.org. admin.example.org. ' + new_serial + ' 3600 1800 2419200 7200')
+    step.given('Run the DDNS update')
+
+@step('use DDNS to add a record (.*)')
+def set_serial_to(step, new_record):
+    '''
+    Convenience compound step; prepare an update for example.org,
+    which adds one record, then runs the update.
+    '''
+    step.given('Prepare a DDNS update')
+    step.given('add to the DDNS update: update add ' + new_record)
+    step.given('Run the DDNS update')
+
+@step('set DDNS ACL ([0-9]+) for ([0-9.]+) to ([A-Z]+)')
+def set_ddns_acl_to(step, nr, address, action):
+    '''
+    Replaces the ACL at the given index for the given
+    address, to the given action
+    '''
+    step.given('set bind10 configuration DDNS/zones[' + nr + ']/update_acl to [{"action": "' + action + '", "from": "' + address + '"}]')
+    step.given('last bindctl output should not contain Error')