Browse Source

[trac931] corrected a confusing comment in addRemoteConfig().
added some comments about how the remote config value is retrieved
in a test case.

JINMEI Tatuya 14 years ago
parent
commit
e37672ef8e
2 changed files with 4 additions and 2 deletions
  1. 1 1
      src/lib/config/ccsession.cc
  2. 3 1
      src/lib/config/tests/ccsession_unittests.cc

+ 1 - 1
src/lib/config/ccsession.cc

@@ -429,7 +429,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_name,
     ConstElementPtr new_config = parseAnswer(rcode, answer);
     ElementPtr local_config;
     if (rcode == 0 && new_config) {
-        // Merge the received config into the defaults
+        // Merge the received config into existing local config
         local_config = rmod_config.getLocalConfig();
         isc::data::merge(local_config, new_config);
         rmod_config.setLocalConfig(local_config);

+ 3 - 1
src/lib/config/tests/ccsession_unittests.cc

@@ -427,7 +427,7 @@ TEST_F(CCSessionTest, remoteConfig) {
         EXPECT_NO_THROW(module_name = mccs.addRemoteConfig("Spec2", NULL,
                                                            false));
 
-        size_t qsize(session.getMsgQueue()->size());
+        const size_t qsize(session.getMsgQueue()->size());
         EXPECT_TRUE(session.getMsgQueue()->get(qsize - 2)->equals(*el(
             "[ \"ConfigManager\", \"*\", { \"command\": ["
             "\"get_module_spec\", { \"module_name\": \"Spec2\" } ] } ]")));
@@ -435,6 +435,8 @@ TEST_F(CCSessionTest, remoteConfig) {
             "[ \"ConfigManager\", \"*\", { \"command\": [ \"get_config\","
             "{ \"module_name\": \"Spec2\" } ] } ]")));
         EXPECT_EQ("Spec2", module_name);
+        // Since we returned an empty local config above, the default value
+        // for "item1", which is 1, should be used.
         EXPECT_NO_THROW(item1 =
                         mccs.getRemoteConfigValue(module_name,
                                                   "item1")->intValue());