BIND 10 trac2436, updated. 0c25dda981710f0a8d46e79cfa7b1a5af75c7b7f [2436] Test there's validation in ZoneLoader

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jan 4 15:22:36 UTC 2013


The branch, trac2436 has been updated
       via  0c25dda981710f0a8d46e79cfa7b1a5af75c7b7f (commit)
      from  ccde39b3aa9da7d46b112865780c4af4c686f4b3 (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 0c25dda981710f0a8d46e79cfa7b1a5af75c7b7f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Jan 4 16:22:11 2013 +0100

    [2436] Test there's validation in ZoneLoader

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

Summary of changes:
 src/lib/datasrc/tests/Makefile.am              |    1 +
 src/lib/datasrc/tests/testdata/novalidate.zone |    3 +++
 src/lib/datasrc/tests/zone_loader_unittest.cc  |   19 +++++++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 src/lib/datasrc/tests/testdata/novalidate.zone

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/Makefile.am b/src/lib/datasrc/tests/Makefile.am
index 61858bd..2508585 100644
--- a/src/lib/datasrc/tests/Makefile.am
+++ b/src/lib/datasrc/tests/Makefile.am
@@ -118,3 +118,4 @@ EXTRA_DIST += testdata/new_minor_schema.sqlite3
 EXTRA_DIST += testdata/newschema.sqlite3
 EXTRA_DIST += testdata/oldschema.sqlite3
 EXTRA_DIST += testdata/static.zone
+EXTRA_DIST += testdata/novalidate.zone
diff --git a/src/lib/datasrc/tests/testdata/novalidate.zone b/src/lib/datasrc/tests/testdata/novalidate.zone
new file mode 100644
index 0000000..f5a1ca6
--- /dev/null
+++ b/src/lib/datasrc/tests/testdata/novalidate.zone
@@ -0,0 +1,3 @@
+.			86400	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2010030802 1800 900 604800 86400
+; Missing the NS here, will generate an error in validation
+www.       3600    IN   A   192.0.2.1
diff --git a/src/lib/datasrc/tests/zone_loader_unittest.cc b/src/lib/datasrc/tests/zone_loader_unittest.cc
index b19a843..9f4cf2b 100644
--- a/src/lib/datasrc/tests/zone_loader_unittest.cc
+++ b/src/lib/datasrc/tests/zone_loader_unittest.cc
@@ -392,4 +392,23 @@ TEST_F(ZoneLoaderTest, loadSyntaxError) {
     EXPECT_FALSE(destination_client_.commit_called_);
 }
 
+// Test there's validation of the data in the zone loader.
+TEST_F(ZoneLoaderTest, loadValidation) {
+    ZoneLoader loader(destination_client_, Name::ROOT_NAME(),
+                      TEST_DATA_DIR "/novalidate.zone");
+    EXPECT_THROW(loader.loadIncremental(10), ZoneContentError);
+    // The messages go to the log. We don't have an easy way to examine them.
+    EXPECT_FALSE(destination_client_.commit_called_);
+}
+
+// The same test, but for copying from other data source
+TEST_F(ZoneLoaderTest, copyValidation) {
+    prepareSource(Name::ROOT_NAME(), "novalidate.zone");
+    ZoneLoader loader(destination_client_, Name::ROOT_NAME(), source_client_);
+
+    EXPECT_THROW(loader.loadIncremental(10), ZoneContentError);
+    // The messages go to the log. We don't have an easy way to examine them.
+    EXPECT_FALSE(destination_client_.commit_called_);
+}
+
 }



More information about the bind10-changes mailing list