2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#505] added missing test

This commit is contained in:
Razvan Becheriu
2020-08-20 23:28:47 +03:00
parent 5a0d7e9729
commit 442ec1542f

View File

@@ -746,9 +746,11 @@ TEST_F(SharedNetwork6ParserTest, parseWithInvalidRenewRebind) {
use_iface_id_ = true;
std::string config = getWorkingConfig();
ElementPtr config_element = Element::fromJSON(config);
ConstElementPtr valid_element = config_element->get("renew-timer");
ElementPtr invalid_element = boost::const_pointer_cast<Element>(valid_element);
invalid_element->setValue(200);
ConstElementPtr valid_element = config_element->get("rebind-timer");
int64_t value = valid_element->intValue();
valid_element = config_element->get("renew-timer");
ElementPtr mutable_element = boost::const_pointer_cast<Element>(valid_element);
mutable_element->setValue(value + 1);
// Parse configuration specified above.
SharedNetwork6Parser parser;
@@ -758,6 +760,29 @@ TEST_F(SharedNetwork6ParserTest, parseWithInvalidRenewRebind) {
ASSERT_FALSE(network);
}
// This test verifies that shared network parser for IPv6 works properly
// when renew and rebind timers are equal.
TEST_F(SharedNetwork6ParserTest, parseValidWithEqualRenewRebind) {
IfaceMgrTestConfig ifmgr(true);
// Use the configuration with interface-id instead of interface parameter.
use_iface_id_ = true;
std::string config = getWorkingConfig();
ElementPtr config_element = Element::fromJSON(config);
ConstElementPtr valid_element = config_element->get("rebind-timer");
int64_t value = valid_element->intValue();
valid_element = config_element->get("renew-timer");
ElementPtr mutable_element = boost::const_pointer_cast<Element>(valid_element);
mutable_element->setValue(value);
// Parse configuration specified above.
SharedNetwork6Parser parser;
SharedNetwork6Ptr network;
ASSERT_NO_THROW(network = parser.parse(config_element));
ASSERT_TRUE(network);
}
// This test verifies that error is returned when trying to configure a
// shared network with both interface and interface id.
TEST_F(SharedNetwork6ParserTest, mutuallyExclusiveInterfaceId) {