]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#413,!288] Added in new file to Makefile.am
authorThomas Markwalder <tmark@isc.org>
Thu, 28 Mar 2019 17:11:17 +0000 (13:11 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 10 Apr 2019 17:36:13 +0000 (13:36 -0400)
Missed adding it before. Minor mods to make the
globals test work, and others to compile.

src/bin/dhcp6/tests/Makefile.am
src/bin/dhcp6/tests/config_backend_unittest.cc

src/bin/dhcp6/tests/Makefile.am
src/bin/dhcp6/tests/config_backend_unittest.cc

index 81e5078edd14f162feead4aa7edfd64ceed19a7e..15ad57b9de82df10269b7ab1ccd2be8261776acb 100644 (file)
@@ -83,6 +83,7 @@ TESTS += dhcp6_unittests
 # this order.
 dhcp6_unittests_SOURCES  = classify_unittests.cc
 dhcp6_unittests_SOURCES += config_parser_unittest.cc
+dhcp6_unittests_SOURCES += config_backend_unittest.cc
 dhcp6_unittests_SOURCES += confirm_unittest.cc
 dhcp6_unittests_SOURCES += ctrl_dhcp6_srv_unittest.cc
 dhcp6_unittests_SOURCES += d2_unittest.cc d2_unittest.h
index 0d4d50ffb6a5fe79e93066ee88cd35ca6965689c..893f2384fd575bce29a81612e000cc6bfc2aa5cf 100644 (file)
@@ -10,6 +10,7 @@
 #include <gtest/gtest.h>
 
 #include <database/backend_selector.h>
+#include <dhcp/option_string.h>
 #include <dhcp/tests/iface_mgr_test_config.h>
 #include <dhcp6/dhcp6_srv.h>
 #include <dhcp6/ctrl_dhcp6_srv.h>
@@ -168,11 +169,10 @@ TEST_F(Dhcp6CBTest, mergeGlobals) {
         "    \"interfaces-config\": { \n"
         "        \"interfaces\": [\"*\" ] \n"
         "    }, \n"
-        "    \"echo-client-id\": false, \n"
         "    \"decline-probation-period\": 7000, \n"
         "    \"valid-lifetime\": 1000, \n"
         "    \"rebind-timer\": 800, \n"
-        "    \"server-hostname\": \"overwrite.me.com\", \n"
+        "    \"server-tag\": \"first-server\", \n"
         "    \"config-control\": { \n"
         "       \"config-databases\": [ { \n"
         "               \"type\": \"memfile\", \n"
@@ -188,18 +188,14 @@ TEST_F(Dhcp6CBTest, mergeGlobals) {
     extractConfig(base_config);
 
     // Make some globals:
-    StampedValuePtr server_hostname(new StampedValue("server-hostname", "isc.example.org"));
+    StampedValuePtr server_tag(new StampedValue("server-tag", "second-server"));
     StampedValuePtr decline_period(new StampedValue("decline-probation-period", Element::create(86400)));
-    StampedValuePtr calc_tee_times(new StampedValue("calculate-tee-times", Element::create(bool(false))));
-    StampedValuePtr t2_percent(new StampedValue("t2-percent", Element::create(0.75)));
     StampedValuePtr renew_timer(new StampedValue("renew-timer", Element::create(500)));
 
     // Let's add all of the globals to the second backend.  This will verify
     // we find them there.
-    db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), server_hostname);
+    db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), server_tag);
     db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), decline_period);
-    db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), calc_tee_times);
-    db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), t2_percent);
     db2_->createUpdateGlobalParameter6(ServerSelector::ALL(), renew_timer);
 
     // Should parse and merge without error.
@@ -209,10 +205,6 @@ TEST_F(Dhcp6CBTest, mergeGlobals) {
     // CfgMgr::instance().commit() hasn't been called)
     SrvConfigPtr staging_cfg = CfgMgr::instance().getStagingCfg();
 
-    // echo-client-id is set explicitly in the original config, meanwhile
-    // the backend config does not set it, so the explicit value wins.
-    EXPECT_FALSE(staging_cfg->getEchoClientId());
-
     // decline-probation-period is an explicit member that should come
     // from the backend.
     EXPECT_EQ(86400, staging_cfg->getDeclinePeriod());
@@ -224,9 +216,7 @@ TEST_F(Dhcp6CBTest, mergeGlobals) {
                                                   Element::create(800)));
 
     // Verify that the implicit globals from the backend are there.
-    ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, server_hostname));
-    ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, calc_tee_times));
-    ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, t2_percent));
+    ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, server_tag));
     ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, renew_timer));
 }
 
@@ -315,7 +305,7 @@ TEST_F(Dhcp6CBTest, DISABLED_mergeOptions) {
         "        \"name\": \"dhcp-message\", \n"
         "        \"data\": \"0A0B0C0D\", \n"
         "        \"csv-format\": false \n"
-        "     },{ \n" 
+        "     },{ \n"
         "        \"name\": \"host-name\", \n"
         "        \"data\": \"old.example.com\", \n"
         "        \"csv-format\": true \n"
@@ -372,7 +362,7 @@ TEST_F(Dhcp6CBTest, DISABLED_mergeOptions) {
     ASSERT_TRUE(found_opt.option_);
     EXPECT_EQ("0x0A0B0C0D", found_opt.option_->toHexString());
 
-    // host-name should come from the first back end, 
+    // host-name should come from the first back end,
     // (overwriting the original).
     found_opt = options->get("dhcp6", DHO_HOST_NAME);
     ASSERT_TRUE(found_opt.option_);
@@ -425,7 +415,7 @@ TEST_F(Dhcp6CBTest, DISABLED_mergeSharedNetworks) {
     // CfgMgr::instance().commit() hasn't been called)
     SrvConfigPtr staging_cfg = CfgMgr::instance().getStagingCfg();
 
-    CfgSharedNetworks4Ptr networks = staging_cfg->getCfgSharedNetworks4();
+    CfgSharedNetworks6Ptr networks = staging_cfg->getCfgSharedNetworks6();
     SharedNetwork6Ptr staged_network;
 
     // SharedNetwork One should have been added from db1 config