BIND 10 trac1790, updated. 053f67d53fc956ea60065b71ad042654bba17a7c [1794] Add a lettuce test for updating in-memory after xfr feature

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Apr 20 07:02:21 UTC 2012


The branch, trac1790 has been updated
       via  053f67d53fc956ea60065b71ad042654bba17a7c (commit)
       via  b0a363d5a85c8c5e00fdd950d973d46ed80b9dea (commit)
       via  b3a5fbb447a548dad8f6ca934877c652cccd07c5 (commit)
       via  407c2de052c7df7b88503b7046b9f77d3b3215f7 (commit)
      from  b0b3abdfb7ff228da9ae3251d653fe7e4624e21e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 053f67d53fc956ea60065b71ad042654bba17a7c
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Apr 20 12:32:00 2012 +0530

    [1794] Add a lettuce test for updating in-memory after xfr feature

commit b0a363d5a85c8c5e00fdd950d973d46ed80b9dea
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Apr 20 12:20:07 2012 +0530

    [master] Use IPv4 addresses in tests consistently

commit b3a5fbb447a548dad8f6ca934877c652cccd07c5
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Apr 20 12:19:23 2012 +0530

    [1790] Bugfix _do_auth_loadzone implementation

commit 407c2de052c7df7b88503b7046b9f77d3b3215f7
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Apr 20 10:18:48 2012 +0530

    [master] Update the xfrin_bind10.feature test
    
    * Remove the redundant CMDCTL_STARTED check
    * Add checks for data/test_nonexistent_db.sqlite3

-----------------------------------------------------------------------

Summary of changes:
 src/bin/xfrin/xfrin.py.in                          |   22 ++++++++-----
 .../secondary.conf => xfrin/inmem_slave.conf}      |    8 +++--
 .../configurations/xfrin/retransfer_master.conf    |    2 +-
 tests/lettuce/data/.gitignore                      |    1 +
 tests/lettuce/data/inmem-xfrin                     |    7 ++++
 .../lettuce/data/inmem-xfrin.sqlite3.orig          |  Bin 13312 -> 13312 bytes
 .../lettuce/features/inmemory_over_sqlite3.feature |   33 +++++++++++++++++++-
 tests/lettuce/features/terrain/terrain.py          |    4 ++-
 tests/lettuce/features/xfrin_bind10.feature        |    9 +++--
 9 files changed, 69 insertions(+), 17 deletions(-)
 copy tests/lettuce/configurations/{inmemory_over_sqlite3/secondary.conf => xfrin/inmem_slave.conf} (81%)
 create mode 100644 tests/lettuce/data/inmem-xfrin
 copy src/bin/dbutil/tests/testdata/empty_version.sqlite3 => tests/lettuce/data/inmem-xfrin.sqlite3.orig (72%)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index adc698b..814695c 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -1550,18 +1550,25 @@ class Xfrin:
         if is_default:
             return
         for d in datasources:
-            if d.has_key("class"):
+            if "class" in d:
                 dclass = d["class"]
             else:
                 dclass = "IN"
-            if d["type"].lower() == "memory" and dclass.lower() == zone_class.lower():
+            if d["type"].lower() == "memory" and dclass.lower() == zone_class.to_text().lower():
                 for zone in d["zones"]:
-                    if zone["filetype"].lower() == "sqlite3" and\
-                            zone["origin"].lower() == zone_name.lower():
-                        param = {"origin": zone_name.to_text(),
+                    # Remove trailing periods
+                    n1 = zone["origin"]
+                    if n1[-1] == '.':
+                        n1 = n1[:-1]
+                    n2 = zone_name.to_text()
+                    if n2[-1] == '.':
+                        n2 = n2[:-1]
+
+                    if zone["filetype"].lower() == "sqlite3" and n1.lower() == n2.lower():
+                        param = {"origin": n1,
                                  "class": zone_class.to_text(),
                                  "datasrc": d["type"]}
-                        logger.debug(XFRIN_AUTH_LOADZONE,
+                        logger.debug(DBG_XFRIN_TRACE, XFRIN_AUTH_LOADZONE,
                                      param["origin"], param["class"], param["datasrc"])
 
                         msg = create_command("loadzone", param)
@@ -1584,6 +1591,7 @@ class Xfrin:
         param = {'zone_name': zone_name.to_text(),
                  'zone_class': zone_class.to_text()}
         if xfr_result == XFRIN_OK:
+            self._do_auth_loadzone(zone_name, zone_class)
             msg = create_command(notify_out.ZONE_NEW_DATA_READY_CMD, param)
             # catch the exception, in case msgq has been killed.
             try:
@@ -1603,8 +1611,6 @@ class Xfrin:
             except socket.error as err:
                 logger.error(XFRIN_MSGQ_SEND_ERROR, XFROUT_MODULE_NAME, ZONE_MANAGER_MODULE_NAME)
 
-            self._do_auth_loadzone(zone_name, zone_class)
-
         else:
             msg = create_command(ZONE_XFRIN_FAILED, param)
             # catch the exception, in case msgq has been killed.
diff --git a/tests/lettuce/configurations/xfrin/inmem_slave.conf b/tests/lettuce/configurations/xfrin/inmem_slave.conf
new file mode 100644
index 0000000..3e4b368
--- /dev/null
+++ b/tests/lettuce/configurations/xfrin/inmem_slave.conf
@@ -0,0 +1,34 @@
+{
+    "version": 2,
+    "Logging": {
+        "loggers": [ {
+            "debuglevel": 99,
+            "severity": "DEBUG",
+            "name": "*"
+        } ]
+    },
+    "Auth": {
+        "database_file": "data/inmem-xfrin.sqlite3",
+        "datasources": [ {
+            "type": "memory",
+	    "class": "IN",
+            "zones": [ {
+                "origin": "example.org",
+                "file": "data/inmem-xfrin.sqlite3",
+                "filetype": "sqlite3"
+            } ]
+        } ],
+        "listen_on": [ {
+            "port": 47806,
+            "address": "127.0.0.1"
+        } ]
+    },
+    "Boss": {
+        "components": {
+            "b10-auth": { "kind": "needed", "special": "auth" },
+            "b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
+            "b10-zonemgr": { "address": "Zonemgr", "kind": "dispensable" },
+            "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
+        }
+    }
+}
diff --git a/tests/lettuce/configurations/xfrin/retransfer_master.conf b/tests/lettuce/configurations/xfrin/retransfer_master.conf
index eae47a6..366fdb4 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_master.conf
+++ b/tests/lettuce/configurations/xfrin/retransfer_master.conf
@@ -11,7 +11,7 @@
         "database_file": "data/example.org.sqlite3",
         "listen_on": [ {
             "port": 47807,
-            "address": "::1"
+            "address": "127.0.0.1"
         } ]
     },
     "Xfrout": {
diff --git a/tests/lettuce/data/.gitignore b/tests/lettuce/data/.gitignore
index 299b6d2..8c54200 100644
--- a/tests/lettuce/data/.gitignore
+++ b/tests/lettuce/data/.gitignore
@@ -1 +1,2 @@
+/inmem-xfrin.sqlite3
 /test_nonexistent_db.sqlite3
diff --git a/tests/lettuce/data/inmem-xfrin b/tests/lettuce/data/inmem-xfrin
new file mode 100644
index 0000000..9e02591
--- /dev/null
+++ b/tests/lettuce/data/inmem-xfrin
@@ -0,0 +1,7 @@
+example.org.	3600	IN	SOA	ns1.example.org. admin.example.org. 1234 3600 1800 2419200 7200
+example.org.	3600	IN	NS	ns1.example.org.
+example.org.	3600	IN	NS	ns2.example.org.
+example.org.	3600	IN	MX	10 mail.example.org.
+www.example.org.	3600	IN	A	192.0.2.63
+ns1.example.org.	3600	IN	A	192.0.2.3
+ns2.example.org.	3600	IN	A	192.0.2.4
diff --git a/tests/lettuce/data/inmem-xfrin.sqlite3.orig b/tests/lettuce/data/inmem-xfrin.sqlite3.orig
new file mode 100644
index 0000000..287d980
Binary files /dev/null and b/tests/lettuce/data/inmem-xfrin.sqlite3.orig differ
diff --git a/tests/lettuce/features/inmemory_over_sqlite3.feature b/tests/lettuce/features/inmemory_over_sqlite3.feature
index d9990ed..c3ad786 100644
--- a/tests/lettuce/features/inmemory_over_sqlite3.feature
+++ b/tests/lettuce/features/inmemory_over_sqlite3.feature
@@ -3,10 +3,41 @@ Feature: In-memory zone using SQLite3 backend
     data source that uses the SQLite3 data source as the backend, and tests
     scenarios that update the zone via incoming zone transfers.
 
-    Scenario: Load and response
+    Scenario: 1. Load and response
         Given I have bind10 running with configuration inmemory_over_sqlite3/secondary.conf
         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
         A query for www.example.org should have rcode NOERROR
         The SOA serial for example.org should be 1234
+
+    Scenario: 2. In-memory datasource backed by sqlite3
+        Given I have bind10 running with configuration xfrin/retransfer_master.conf with cmdctl port 47804 as master
+        And wait for master stderr message BIND10_STARTED_CC
+        And wait for master stderr message CMDCTL_STARTED
+        And wait for master stderr message AUTH_SERVER_STARTED
+        And wait for master stderr message XFROUT_STARTED
+        And wait for master stderr message ZONEMGR_STARTED
+
+        And I have bind10 running with configuration xfrin/inmem_slave.conf
+        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 XFRIN_STARTED
+        And wait for bind10 stderr message ZONEMGR_STARTED
+
+        A query for www.example.org should have rcode NOERROR
+        """
+        www.example.org.        3600    IN      A       192.0.2.63
+        """
+        A query for mail.example.org should have rcode NXDOMAIN
+        When I send bind10 the command Xfrin retransfer example.org IN 127.0.0.1 47807
+        Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
+	Then wait for new bind10 stderr message AUTH_LOAD_ZONE
+
+        A query for www.example.org should have rcode NOERROR
+        The answer section of the last query response should be
+        """
+        www.example.org.        3600    IN      A       192.0.2.1
+        """
+        A query for mail.example.org should have rcode NOERROR
diff --git a/tests/lettuce/features/terrain/terrain.py b/tests/lettuce/features/terrain/terrain.py
index 753d912..61fd5fa 100644
--- a/tests/lettuce/features/terrain/terrain.py
+++ b/tests/lettuce/features/terrain/terrain.py
@@ -49,7 +49,9 @@ copylist = [
     ["configurations/resolver/resolver_basic.config.orig",
      "configurations/resolver/resolver_basic.config"],
     ["configurations/multi_instance/multi_auth.config.orig",
-     "configurations/multi_instance/multi_auth.config"]
+     "configurations/multi_instance/multi_auth.config"],
+    ["data/inmem-xfrin.sqlite3.orig",
+     "data/inmem-xfrin.sqlite3"]
 ]
 
 # This is a list of files that, if present, will be removed before a scenario
diff --git a/tests/lettuce/features/xfrin_bind10.feature b/tests/lettuce/features/xfrin_bind10.feature
index 2a56356..f2a7e8d 100644
--- a/tests/lettuce/features/xfrin_bind10.feature
+++ b/tests/lettuce/features/xfrin_bind10.feature
@@ -2,6 +2,8 @@ Feature: Xfrin
     Tests for Xfrin, specific for BIND 10 behaviour.
     
     Scenario: Retransfer command
+    The file data/test_nonexistent_db.sqlite3 should not exist
+
     Given I have bind10 running with configuration xfrin/retransfer_master.conf with cmdctl port 47804 as master
     And wait for master stderr message BIND10_STARTED_CC
     And wait for master stderr message CMDCTL_STARTED
@@ -17,8 +19,7 @@ Feature: Xfrin
     And wait for bind10 stderr message ZONEMGR_STARTED
 
     A query for www.example.org should have rcode REFUSED
-    Wait for bind10 stderr message CMDCTL_STARTED
-    When I send bind10 the command Xfrin retransfer example.org IN ::1 47807
+    When I send bind10 the command Xfrin retransfer example.org IN 127.0.0.1 47807
     Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
     A query for www.example.org should have rcode NOERROR
 
@@ -27,5 +28,7 @@ Feature: Xfrin
     # should be 13, counting the duplicated SOA.
     # At this point we can confirm both in and out of AXFR for a zone
     # containing an NSEC3 RR.
-    When I do an AXFR transfer of example.org from ::1 47807
+    When I do an AXFR transfer of example.org from 127.0.0.1 47807
     Then transfer result should have 13 rrs
+
+    The file data/test_nonexistent_db.sqlite3 should exist



More information about the bind10-changes mailing list