From: Andrei Pavel Date: Tue, 18 Jan 2022 14:49:08 +0000 (+0200) Subject: [#2264] test IPv6 URL in HA X-Git-Tag: Kea-2.0.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2935aab74633c229873751be958ca10a0a45a453;p=thirdparty%2Fkea.git [#2264] test IPv6 URL in HA --- diff --git a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc index a1fc75bf43..4e06db426a 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC") // // 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 @@ -1854,4 +1854,35 @@ TEST_F(HAConfigTest, multiThreadingPermutations) { } } +// Check that an IPv6 address can be used as part of a value for "url". +TEST_F(HAConfigTest, ipv6Url) { + std::string const ha_config(R"( + [ + { + "mode": "load-balancing", + "peers": [ + { + "name": "server1", + "role": "primary", + "url": "http://[2001:db8::1]:8080/" + }, + { + "name": "server2", + "role": "secondary", + "url": "http://[2001:db8::2]:8080/" + } + ], + "this-server-name": "server1" + } + ] + )"); + + // Configure HA. + HAImplPtr impl(new HAImpl()); + ASSERT_NO_THROW_LOG(impl->configure(Element::fromJSON(ha_config))); + + // Check the URL. + EXPECT_EQ(impl->getConfig()->getThisServerConfig()->getUrl().toText(), "http://[2001:db8::1]:8080/"); +}; + } // end of anonymous namespace