From: Marcin Siodelski Date: Wed, 11 Oct 2017 07:53:44 +0000 (+0200) Subject: [5364] Minor updates as a result of review. X-Git-Tag: trac5297_base~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfefff019b833e658520b7fdf9ef58149c2a0f7f;p=thirdparty%2Fkea.git [5364] Minor updates as a result of review. - Commentary for one test corrected. - Test for rapid-commit now uses a hint to make first allocation to make sure that the expected address is allocated. --- diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 0c966dacfd..e7c0665f78 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -5961,7 +5961,8 @@ TEST_F(Dhcp6ParserTest, sharedNetworksRapidCommit) { EXPECT_FALSE(subs->at(0)->getRapidCommit()); } -// Tests if rapid-commit is derived properly. +// Tests that non-matching rapid-commit setting for subnets belonging to a +// shared network cause configuration error. TEST_F(Dhcp6ParserTest, sharedNetworksRapidCommitMix) { string config = "{\n" diff --git a/src/bin/dhcp6/tests/shared_network_unittest.cc b/src/bin/dhcp6/tests/shared_network_unittest.cc index db20ccb44c..ddb5be450a 100644 --- a/src/bin/dhcp6/tests/shared_network_unittest.cc +++ b/src/bin/dhcp6/tests/shared_network_unittest.cc @@ -1186,10 +1186,15 @@ public: // Client #1 should be assigned an address from shared network. The first // subnet has rapid-commit enabled, so the address should be assigned. - ASSERT_NO_THROW(client1.requestAddress(0xabca0)); + // We provide a hint for this allocation to make sure that the address + // from the first subnet is allocated. In theory, an address from the + // second subnet could be allocated as well if the hint was not provided. + IOAddress requested_address = exp_addr1.empty() ? IOAddress::IPV6_ZERO_ADDRESS() : + IOAddress(exp_addr1); + ASSERT_NO_THROW(client1.requestAddress(0xabca0, requested_address)); testAssigned([this, &client1] { - ASSERT_NO_THROW(client1.doSolicit()); - }); + ASSERT_NO_THROW(client1.doSolicit()); + }); // Make sure something was sent back. ASSERT_TRUE(client1.getContext().response_); @@ -1218,8 +1223,8 @@ public: // subnet does not allow rapid-commit. ASSERT_NO_THROW(client2.requestAddress(0xabca0)); testAssigned([this, &client2] { - ASSERT_NO_THROW(client2.doSolicit()); - }); + ASSERT_NO_THROW(client2.doSolicit()); + }); // Make sure something was sent back. ASSERT_TRUE(client2.getContext().response_);