]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3281] Addressed review comments.
authorMarcin Siodelski <marcin@isc.org>
Mon, 31 Mar 2014 18:56:54 +0000 (20:56 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 31 Mar 2014 18:56:54 +0000 (20:56 +0200)
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/lib/dhcpsrv/cfgmgr.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc

index 7d9a3e234022b8226e91411aaf0711b7203c03a0..e01c1dde96714b1286f06cb58acc181eed7f02a5 100644 (file)
@@ -576,16 +576,9 @@ TEST_F(Dhcp4ParserTest, multipleSubnets) {
 
     ElementPtr json = Element::fromJSON(config);
 
-    EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
-    ASSERT_TRUE(x);
-    comment_ = parseAnswer(rcode_, x);
-    ASSERT_EQ(0, rcode_);
-
     int cnt = 0; // Number of reconfigurations
 
     do {
-        ElementPtr json = Element::fromJSON(config);
-
         EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
         ASSERT_TRUE(x);
         comment_ = parseAnswer(rcode_, x);
@@ -639,16 +632,8 @@ TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) {
 
     ElementPtr json = Element::fromJSON(config);
 
-    EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
-    ASSERT_TRUE(x);
-    comment_ = parseAnswer(rcode_, x);
-    ASSERT_EQ(0, rcode_);
-
     int cnt = 0; // Number of reconfigurations
-
     do {
-        ElementPtr json = Element::fromJSON(config);
-
         EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
         ASSERT_TRUE(x);
         comment_ = parseAnswer(rcode_, x);
@@ -666,7 +651,7 @@ TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) {
 
         // Repeat reconfiguration process 10 times and check that the subnet-id
         // is set to the same value.
-    } while (++cnt < 10);
+    } while (++cnt < 3);
 }
 
 // Check that the configuration with two subnets having the same id is rejected.
index e1d70b15b70bfbd47a28e6a94a03c9f32a280d30..42ba1128e562ec387cd552640b35312227c182f1 100644 (file)
@@ -598,9 +598,9 @@ TEST_F(Dhcp6ParserTest, multipleSubnets) {
 
     int cnt = 0; // Number of reconfigurations
 
-    do {
-        ElementPtr json = Element::fromJSON(config);
+    ElementPtr json = Element::fromJSON(config);
 
+    do {
         EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
         ASSERT_TRUE(x);
         comment_ = parseAnswer(rcode_, x);
@@ -655,9 +655,9 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) {
 
     int cnt = 0; // Number of reconfigurations
 
-    do {
-        ElementPtr json = Element::fromJSON(config);
+    ElementPtr json = Element::fromJSON(config);
 
+    do {
         EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
         ASSERT_TRUE(x);
         comment_ = parseAnswer(rcode_, x);
@@ -675,7 +675,7 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) {
 
         // Repeat reconfiguration process 10 times and check that the subnet-id
         // is set to the same value.
-    } while (++cnt < 10);
+    } while (++cnt < 3);
 }
 
 // CHeck that the configuration with two subnets having the same id is rejected.
@@ -824,7 +824,6 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
     /// CASE 2: Configure 4 subnets, then reconfigure and remove one
     /// from in between (not first, not last)
 
-    /// @todo: Uncomment subnet removal test as part of #3281.
     json = Element::fromJSON(config4);
     EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
     ASSERT_TRUE(x);
index 4c8882856fe04e71879eabe48c9972bbfb872612..12f1e5bf98d888f49f87caba9b4bea0d58ad80f3 100644 (file)
@@ -221,8 +221,7 @@ void CfgMgr::addSubnet6(const Subnet6Ptr& subnet) {
     /// @todo: Check that there is no subnet with the same interface-id
     if (isDuplicate(*subnet)) {
         isc_throw(isc::dhcp::DuplicateSubnetID, "ID of the new IPv6 subnet '"
-                  << subnet->getID() << "' is the same as ID of an existing"
-                  " subnet");
+                  << subnet->getID() << "' is already in use");
     }
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_ADD_SUBNET6)
               .arg(subnet->toText());
@@ -289,8 +288,7 @@ void CfgMgr::addSubnet4(const Subnet4Ptr& subnet) {
     /// other already defined subnet.
     if (isDuplicate(*subnet)) {
         isc_throw(isc::dhcp::DuplicateSubnetID, "ID of the new IPv4 subnet '"
-                  << subnet->getID() << "' is the same as ID of an existing"
-                  " subnet");
+                  << subnet->getID() << "' is already in use");
     }
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_ADD_SUBNET4)
               .arg(subnet->toText());
index 485242eec9fd6d5d9ce277b25e69fc7aeed2b3a6..99332e7f6c5c80dbf5c0d04dd16fe75163f7a055 100644 (file)
@@ -59,7 +59,7 @@ TEST(Subnet4Test, subnetID) {
     EXPECT_NE(id0, id1);
 
     // Create third subnet but this time select an arbitrary id. The id
-    // we use us the one of second subnet. That way we ensure that the
+    // we use the one of the second subnet. That way we ensure that the
     // subnet id we provide via constructor is used and it is not
     // autogenerated - if it was autogenerated we would get id other
     // than id1 because id1 has already been used.