]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2108] Add a basic InMemoryClient::load() test
authorMukund Sivaraman <muks@isc.org>
Wed, 5 Sep 2012 13:11:02 +0000 (18:41 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 5 Sep 2012 13:11:02 +0000 (18:41 +0530)
src/lib/datasrc/memory/tests/Makefile.am
src/lib/datasrc/memory/tests/memory_client_unittest.cc
src/lib/datasrc/memory/tests/testdata/Makefile.am [new file with mode: 0644]
src/lib/datasrc/memory/tests/testdata/example.org-empty.zone [new file with mode: 0644]

index 43dd9f24466f0cef08c9ddf806b6cf78a39e945d..ae32c698da11657725582eacc0191b887eff8764 100644 (file)
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/lib/dns
 AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_srcdir)/testdata\"
 
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 
index 1ca7a2afe22abfb8d774b65d7f1b6571a808cbcc..0a683ff1196ad243ed460453b61f584e5b4b3f10 100644 (file)
@@ -66,6 +66,17 @@ protected:
     memory::ZoneTable* zone_table;
 };
 
+TEST_F(MemoryClientTest, load) {
+    // Zone "example.org." doesn't exist
+    EXPECT_THROW(client_->getIterator(Name("example.org")), DataSourceError);
+    EXPECT_EQ(0, client_->getZoneCount());
+
+    client_->load(Name("example.org"), TEST_DATA_DIR "/example.org-empty.zone");
+    EXPECT_EQ(1, client_->getZoneCount());
+
+    ZoneIteratorPtr iterator(client_->getIterator(Name("example.org")));
+}
+
 TEST_F(MemoryClientTest, getIteratorNonExistent) {
     // Zone "." doesn't exist
     EXPECT_THROW(client_->getIterator(Name(".")), DataSourceError);
diff --git a/src/lib/datasrc/memory/tests/testdata/Makefile.am b/src/lib/datasrc/memory/tests/testdata/Makefile.am
new file mode 100644 (file)
index 0000000..6a2a760
--- /dev/null
@@ -0,0 +1,3 @@
+CLEANFILES = *.copied
+
+EXTRA_DIST = example.org-empty.zone
diff --git a/src/lib/datasrc/memory/tests/testdata/example.org-empty.zone b/src/lib/datasrc/memory/tests/testdata/example.org-empty.zone
new file mode 100644 (file)
index 0000000..f11b9b8
--- /dev/null
@@ -0,0 +1,2 @@
+;; empty example.org zone
+example.org. 3600 IN SOA       ns1.example.org. bugs.x.w.example.org. 68 3600 300 3600000 3600