Browse Source

[2436] Test that warnings don't disrupt loading

Michal 'vorner' Vaner 12 years ago
parent
commit
aff266bfb0

+ 1 - 0
src/lib/datasrc/tests/Makefile.am

@@ -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

+ 4 - 0
src/lib/datasrc/tests/testdata/checkwarn.zone

@@ -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

+ 22 - 0
src/lib/datasrc/tests/zone_loader_unittest.cc

@@ -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());
+
+}
+
 }