BIND 10 trac2862, updated. 0196cde54a656135e1ddfb589109ebcdeff1e75c [2862] Test the SEGMENT_INFO_UPDATE command

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jul 10 09:21:33 UTC 2013


The branch, trac2862 has been updated
       via  0196cde54a656135e1ddfb589109ebcdeff1e75c (commit)
       via  c403a965a2250eec7a500eb9c9d98f7df391e9c3 (commit)
       via  f15ddd7b42b7a7b1079438c135bf946a8850f8da (commit)
      from  509c49f787fe648c70e0bc8eb0b2ab159bd91fd4 (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 0196cde54a656135e1ddfb589109ebcdeff1e75c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Jul 10 11:21:02 2013 +0200

    [2862] Test the SEGMENT_INFO_UPDATE command

commit c403a965a2250eec7a500eb9c9d98f7df391e9c3
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Jul 10 11:20:42 2013 +0200

    [2862] Remove unnecessary public: section
    
    It's already in public section there.

commit f15ddd7b42b7a7b1079438c135bf946a8850f8da
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Jul 10 10:27:10 2013 +0200

    [2862] Remove stray TODO

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

Summary of changes:
 .../auth/tests/datasrc_clients_builder_unittest.cc |   64 ++++++++++++++++++++
 src/lib/datasrc/client_list.h                      |    4 +-
 2 files changed, 65 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
index 53a1f2c..de668f2 100644
--- a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
+++ b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
@@ -629,4 +629,68 @@ TEST_F(DataSrcClientsBuilderTest,
                  TestDataSrcClientsBuilder::InternalCommandError);
 }
 
+// Test the SEGMENT_INFO_UPDATE command. This test is little bit
+// indirect. It doesn't seem possible to fake the client list inside
+// easily. So we create a real image to load and load it. Then we check
+// the segment is used.
+TEST_F(DataSrcClientsBuilderTest,
+#ifdef USE_SHARED_MEMORY
+       segmentInfoUpdate
+#else
+       DISABLED_segmentInfoUpdate
+#endif
+      )
+{
+    // First, prepare the file image to be mapped
+    const ConstElementPtr config = Element::fromJSON(
+        "{"
+        "\"IN\": [{"
+        "   \"type\": \"MasterFiles\","
+        "   \"params\": {"
+        "       \"test1.example\": \""
+        TEST_DATA_BUILDDIR "/test1.zone.copied\"},"
+        "   \"cache-enable\": true,"
+        "   \"cache-type\": \"mapped\""
+        "}]}");
+    const ConstElementPtr segment_config = Element::fromJSON(
+        "{"
+        "  \"mapped-file\": \""
+        TEST_DATA_BUILDDIR "/test1.zone.image" "\"}");
+    clients_map = configureDataSource(config);
+    {
+        const boost::shared_ptr<ConfigurableClientList> list =
+            (*clients_map)[RRClass::IN()];
+        list->resetMemorySegment("MasterFiles",
+                                 memory::ZoneTableSegment::CREATE,
+                                 segment_config);
+        const ConfigurableClientList::ZoneWriterPair result =
+            list->getCachedZoneWriter(isc::dns::Name("test1.example"), false,
+                                      "MasterFiles");
+        ASSERT_EQ(ConfigurableClientList::ZONE_SUCCESS, result.first);
+        result.second->load();
+        result.second->install();
+        // not absolutely necessary, but just in case
+        result.second->cleanup();
+    } // Release this list. That will release the file with the image too,
+      // so we can map it read only from somewhere else.
+
+    // Create a new map, with the same configuration, but without the segments
+    // set
+    clients_map = configureDataSource(config);
+    const boost::shared_ptr<ConfigurableClientList> list =
+        (*clients_map)[RRClass::IN()];
+    EXPECT_EQ(SEGMENT_WAITING, list->getStatus()[0].getSegmentState());
+    // Send the command
+    const ElementPtr command_args = Element::fromJSON(
+        "{"
+        "  \"data-source-name\": \"MasterFiles\","
+        "  \"data-source-class\": \"IN\""
+        "}");
+    command_args->set("segment-params", segment_config);
+    builder.handleCommand(Command(SEGMENT_INFO_UPDATE, command_args,
+                                  FinishedCallback()));
+    // The segment is now used.
+    EXPECT_EQ(SEGMENT_INUSE, list->getStatus()[0].getSegmentState());
+}
+
 } // unnamed namespace
diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h
index e4df415..b4dadff 100644
--- a/src/lib/datasrc/client_list.h
+++ b/src/lib/datasrc/client_list.h
@@ -453,8 +453,6 @@ public:
                             bool want_finder = true) const;
 
     /// \brief This holds one data source client and corresponding information.
-    ///
-    /// \todo The content yet to be defined.
     struct DataSourceInfo {
         DataSourceInfo(DataSourceClient* data_src_client,
                        const DataSourceClientContainerPtr& container,
@@ -526,7 +524,7 @@ public:
     /// This may throw standard exceptions, such as std::bad_alloc. Otherwise,
     /// it is exception free.
     std::vector<DataSourceStatus> getStatus() const;
-public:
+
     /// \brief Access to the data source clients.
     ///
     /// It can be used to examine the loaded list of data sources clients



More information about the bind10-changes mailing list