]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3659] Addressed review comments
authorThomas Markwalder <tmark@isc.org>
Mon, 2 Jun 2025 12:35:47 +0000 (08:35 -0400)
committerThomas Markwalder <tmark@isc.org>
Tue, 3 Jun 2025 11:27:32 +0000 (11:27 +0000)
Fixed minor comments, updated error text in two UTs.

new file:   changelog_unreleased/3659-enable-lease-caching-as-default
modified:   src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
modified:   src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
modified:   src/lib/testutils/test_to_element.cc
modified:   src/lib/testutils/test_to_element.h

changelog_unreleased/3659-enable-lease-caching-as-default [new file with mode: 0644]
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
src/lib/testutils/test_to_element.cc
src/lib/testutils/test_to_element.h

diff --git a/changelog_unreleased/3659-enable-lease-caching-as-default b/changelog_unreleased/3659-enable-lease-caching-as-default
new file mode 100644 (file)
index 0000000..a659773
--- /dev/null
@@ -0,0 +1,7 @@
+[func]*                tmark
+       Lease caching is now enabled by default.  The default
+       value for ``cache-threshold`` is 0.25,``cache-max-age``
+       is left unspecified. It may be disabled at the desired
+       scope either by setting ``cache-threshold`` to 0.0 or
+       setting ``cache-max-age`` to 0.
+       (Gitlab #3659)
index 8ef658f4cb9321d9419bb0c7ca3273a42af0b3fc..89ebad9b0d5c9e7f16d270413bec9e3787a8457d 100644 (file)
@@ -1816,11 +1816,11 @@ TEST(CfgSubnets4Test, cacheParamValidation) {
         {"valid", 0.0, ""},
         {"negative", -.25,
          "subnet configuration failed: cache-threshold:"
-         " -0.25 is invalid, it must be greater than 0.0 and less than 1.0"
+         " -0.25 is invalid, it must be greater than or equal to 0.0 and less than 1.0"
         },
         {"too big", 1.05,
          "subnet configuration failed: cache-threshold:"
-         " 1.05 is invalid, it must be greater than 0.0 and less than 1.0"
+         " 1.05 is invalid, it must be greater than or equal to 0.0 and less than 1.0"
         }
     };
 
index cec7a79f7090672caaaa596596b6f3cec84270d2..fb615d71107d51e5b8e0b5ee6fd044f7446624ef 100644 (file)
@@ -1605,11 +1605,11 @@ TEST(CfgSubnets6Test, cacheParamValidation) {
         {"valid", 0.0, ""},
         {"negative", -.25,
          "subnet configuration failed: cache-threshold:"
-         " -0.25 is invalid, it must be greater than 0.0 and less than 1.0"
+         " -0.25 is invalid, it must be greater than or equal to 0.0 and less than 1.0"
         },
         {"too big", 1.05,
          "subnet configuration failed: cache-threshold:"
-         " 1.05 is invalid, it must be greater than 0.0 and less than 1.0"
+         " 1.05 is invalid, it must be greater than or equal to 0.0 and less than 1.0"
         }
     };
 
index 3e544c52c7f8afab815be5f720171485dc965909..7b432247ccfc326c8f1918df4874d4f97a6ef065 100644 (file)
@@ -51,6 +51,16 @@ void assertEqWithDiff(ConstElementPtr const& a, ConstElementPtr const& b) {
         << generateDiff(pretty_print_a, pretty_print_b) << endl;
 }
 
+void assertEqWithDiff(ElementPtr const& a, ConstElementPtr const& b) {
+    ASSERT_TRUE(a);
+    ASSERT_TRUE(b);
+    string const pretty_print_a(prettyPrint(a));
+    string const pretty_print_b(prettyPrint(b));
+    ASSERT_EQ(pretty_print_a, pretty_print_b)
+        << endl
+        << "Diff:" << endl
+        << generateDiff(pretty_print_a, pretty_print_b) << endl;
+}
 
 #ifdef HAVE_CREATE_UNIFIED_DIFF
 string generateDiff(string left, string right) {
index c588ee5795ca3ddc4369f28ba1750655942a517f..a0e92c2f12a397bbeb9553e4143d3bdd5e2468f6 100644 (file)
@@ -31,6 +31,9 @@ expectEqWithDiff(isc::data::ElementPtr const& left, isc::data::ElementPtr const&
 
 void
 assertEqWithDiff(isc::data::ConstElementPtr const& left, isc::data::ConstElementPtr const& right);
+
+void
+assertEqWithDiff(isc::data::ElementPtr const& left, isc::data::ConstElementPtr const& right);
 /// @}
 
 /// @brief Return the difference between two strings