From: Thomas Markwalder Date: Thu, 28 Mar 2019 17:11:17 +0000 (-0400) Subject: [#413,!288] Added in new file to Makefile.am X-Git-Tag: Kea-1.6.0-beta~270^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cee633f070eaa0f8fbc24423081d340e79626f0b;p=thirdparty%2Fkea.git [#413,!288] Added in new file to Makefile.am 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 --- diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 81e5078edd..15ad57b9de 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -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 diff --git a/src/bin/dhcp6/tests/config_backend_unittest.cc b/src/bin/dhcp6/tests/config_backend_unittest.cc index 0d4d50ffb6..893f2384fd 100644 --- a/src/bin/dhcp6/tests/config_backend_unittest.cc +++ b/src/bin/dhcp6/tests/config_backend_unittest.cc @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -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