2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 15:35:17 +00:00

[#488,!259] Regenerated get_config_unittests for v4 and corrected issues.

This commit is contained in:
Marcin Siodelski
2019-03-05 20:43:24 +01:00
parent fdcced6640
commit e54dfbedc6
5 changed files with 438 additions and 6 deletions

View File

@@ -6400,7 +6400,6 @@ TEST_F(Dhcp4ParserTest, globalReservations) {
// This test verifies that configuration control with unsupported type fails // This test verifies that configuration control with unsupported type fails
TEST_F(Dhcp4ParserTest, configControlInfoNoFactory) { TEST_F(Dhcp4ParserTest, configControlInfoNoFactory) {
string config = PARSER_CONFIGS[6]; string config = PARSER_CONFIGS[6];
extractConfig(config);
// Should fail because "type=mysql" has no factories. // Should fail because "type=mysql" has no factories.
configure(config, CONTROL_RESULT_ERROR, configure(config, CONTROL_RESULT_ERROR,
@@ -6410,7 +6409,6 @@ TEST_F(Dhcp4ParserTest, configControlInfoNoFactory) {
// This test verifies that configuration control info gets populated. // This test verifies that configuration control info gets populated.
TEST_F(Dhcp4ParserTest, configControlInfo) { TEST_F(Dhcp4ParserTest, configControlInfo) {
string config = PARSER_CONFIGS[6]; string config = PARSER_CONFIGS[6];
extractConfig(config);
// Should be able to register a backend factory for "mysql". // Should be able to register a backend factory for "mysql".
ASSERT_TRUE(TestConfigBackendDHCPv4:: ASSERT_TRUE(TestConfigBackendDHCPv4::

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this

View File

@@ -187,10 +187,18 @@ Network::toElement() const {
map->set("option-data", opts->toElement()); map->set("option-data", opts->toElement());
// Output calcualte-tee-times and percentages if calculation is enabled. // Output calcualte-tee-times and percentages if calculation is enabled.
bool calc_tee_times = getCalculateTeeTimes(); auto calc_tee_times = getCalculateTeeTimes();
if (calc_tee_times) { if (!calc_tee_times.unspecified()) {
map->set("calculate-tee-times", Element::create(calc_tee_times)); map->set("calculate-tee-times", Element::create(calc_tee_times));
}
auto t1_percent = getT1Percent();
if (!t1_percent.unspecified()) {
map->set("t1-percent", Element::create(getT1Percent())); map->set("t1-percent", Element::create(getT1Percent()));
}
auto t2_percent = getT2Percent();
if (!t2_percent.unspecified()) {
map->set("t2-percent", Element::create(getT2Percent())); map->set("t2-percent", Element::create(getT2Percent()));
} }

View File

@@ -872,7 +872,7 @@ TEST(CfgSubnets4Test, unparseSubnet) {
Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3, 125)); Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3, 125));
subnet1->allowClientClass("foo"); subnet1->allowClientClass("foo");
// These two should not appear, as calculateTeeTimes should be false.
subnet1->setT1Percent(0.45); subnet1->setT1Percent(0.45);
subnet1->setT2Percent(0.70); subnet1->setT2Percent(0.70);
@@ -901,6 +901,8 @@ TEST(CfgSubnets4Test, unparseSubnet) {
" \"comment\": \"foo\",\n" " \"comment\": \"foo\",\n"
" \"id\": 123,\n" " \"id\": 123,\n"
" \"subnet\": \"192.0.2.0/26\",\n" " \"subnet\": \"192.0.2.0/26\",\n"
" \"t1-percent\": 0.45,"
" \"t2-percent\": 0.7,"
" \"match-client-id\": true,\n" " \"match-client-id\": true,\n"
" \"next-server\": \"0.0.0.0\",\n" " \"next-server\": \"0.0.0.0\",\n"
" \"server-hostname\": \"\",\n" " \"server-hostname\": \"\",\n"