From: Michal 'vorner' Vaner Date: Wed, 9 Jan 2013 10:06:43 +0000 (+0100) Subject: [2436] Test that warnings don't disrupt loading X-Git-Tag: bind10-1.0.0-rc-release~99^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aff266bfb0c5ea0d8553fb249aacd91f4f414476;p=thirdparty%2Fkea.git [2436] Test that warnings don't disrupt loading --- diff --git a/src/lib/datasrc/tests/Makefile.am b/src/lib/datasrc/tests/Makefile.am index 2508585d72..7c61826d3c 100644 --- a/src/lib/datasrc/tests/Makefile.am +++ b/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 diff --git a/src/lib/datasrc/tests/testdata/checkwarn.zone b/src/lib/datasrc/tests/testdata/checkwarn.zone new file mode 100644 index 0000000000..223fcff2aa --- /dev/null +++ b/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 diff --git a/src/lib/datasrc/tests/zone_loader_unittest.cc b/src/lib/datasrc/tests/zone_loader_unittest.cc index 5c389bd818..111f5db545 100644 --- a/src/lib/datasrc/tests/zone_loader_unittest.cc +++ b/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()); + +} + }