]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2436] Test that warnings don't disrupt loading
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Wed, 9 Jan 2013 10:06:43 +0000 (11:06 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Wed, 9 Jan 2013 10:06:43 +0000 (11:06 +0100)
src/lib/datasrc/tests/Makefile.am
src/lib/datasrc/tests/testdata/checkwarn.zone [new file with mode: 0644]
src/lib/datasrc/tests/zone_loader_unittest.cc

index 2508585d7204b3c1f84850549ba193a4cb89e929..7c61826d3c59ba7e0d46091bb985d539bfdab40b 100644 (file)
@@ -119,3 +119,4 @@ EXTRA_DIST += testdata/newschema.sqlite3
 EXTRA_DIST += testdata/oldschema.sqlite3
 EXTRA_DIST += testdata/static.zone
 EXTRA_DIST += testdata/novalidate.zone
+EXTRA_DIST += testdata/checkwarn.zone
diff --git a/src/lib/datasrc/tests/testdata/checkwarn.zone b/src/lib/datasrc/tests/testdata/checkwarn.zone
new file mode 100644 (file)
index 0000000..223fcff
--- /dev/null
@@ -0,0 +1,4 @@
+.                      86400   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2010030802 1800 900 604800 86400
+.           86400   IN  NS  ns.
+; Missing the address for the nameserver. This should generate a warning, but not error.
+www.       3600    IN   A   192.0.2.1
index 5c389bd818bf3c91743ecc38a706114938010bb1..111f5db545037155de0d8aac853431355d8fe6a8 100644 (file)
@@ -440,4 +440,26 @@ TEST_F(ZoneLoaderTest, copyCheck) {
     EXPECT_FALSE(destination_client_.commit_called_);
 }
 
+// Check a warning doesn't disrupt the loading of the zone
+TEST_F(ZoneLoaderTest, loadCheckWarn) {
+    ZoneLoader loader(destination_client_, Name::ROOT_NAME(),
+                      TEST_DATA_DIR "/checkwarn.zone");
+    EXPECT_TRUE(loader.loadIncremental(10));
+    // The messages go to the log. We don't have an easy way to examine them.
+    // But the zone was committed and contains all 3 RRs
+    EXPECT_TRUE(destination_client_.commit_called_);
+    EXPECT_EQ(3, destination_client_.rrsets_.size());
+}
+
+TEST_F(ZoneLoaderTest, copyCheckWarn) {
+    prepareSource(Name::ROOT_NAME(), "checkwarn.zone");
+    ZoneLoader loader(destination_client_, Name::ROOT_NAME(), source_client_);
+    EXPECT_TRUE(loader.loadIncremental(10));
+    // The messages go to the log. We don't have an easy way to examine them.
+    // But the zone was committed and contains all 3 RRs
+    EXPECT_TRUE(destination_client_.commit_called_);
+    EXPECT_EQ(3, destination_client_.rrsets_.size());
+
+}
+
 }