From: Jelte Jansen Date: Tue, 12 Jun 2012 13:34:17 +0000 (+0200) Subject: [1461] DDNS test set 2 X-Git-Tag: trac2351_base~226^2~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fbb8d8ac7159dee46405864cb0c2bd32e4ece312;p=thirdparty%2Fkea.git [1461] DDNS test set 2 --- diff --git a/tests/lettuce/features/ddns_system.feature b/tests/lettuce/features/ddns_system.feature index 4e3f41c79b..a7f58559d9 100644 --- a/tests/lettuce/features/ddns_system.feature +++ b/tests/lettuce/features/ddns_system.feature @@ -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 diff --git a/tests/lettuce/features/terrain/nsupdate.py b/tests/lettuce/features/terrain/nsupdate.py index 8c5fef4c8a..afd2cda493 100644 --- a/tests/lettuce/features/terrain/nsupdate.py +++ b/tests/lettuce/features/terrain/nsupdate.py @@ -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')