]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Update the resolver unit test
authorAram Sargsyan <aram@isc.org>
Thu, 6 Jun 2024 19:58:57 +0000 (19:58 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Thu, 1 Aug 2024 18:30:35 +0000 (18:30 +0000)
Before there was a gap from 301 to 9999 which would be converted
to 10000 and now there is no such gap.

This settimeout_belowmin test was checking the behavior of a value
in the gap. As there is now no gap left, the minimum is 301 and
anything below that is converted to seconds as before. In order
for this check to still test the "below minimum" behavior, change
the value from 9000 to 300.

Update the settimeout_overmax value test too so it logically aligns
with the minimum value test.

tests/dns/resolver_test.c

index 3f53f9f3514e31bbb92a2edcaebdf208e4f01f8b..f53cfd684a61038f966ed9fb6365b20818b31072 100644 (file)
@@ -158,10 +158,10 @@ ISC_LOOP_TEST_IMPL(settimeout_belowmin) {
        mkres(&resolver);
 
        default_timeout = dns_resolver_gettimeout(resolver);
-       dns_resolver_settimeout(resolver, 9000);
+       dns_resolver_settimeout(resolver, 300);
 
        timeout = dns_resolver_gettimeout(resolver);
-       assert_int_equal(timeout, default_timeout);
+       assert_in_range(timeout, default_timeout, 3999999);
 
        destroy_resolver(&resolver);
        isc_loopmgr_shutdown(loopmgr);
@@ -170,13 +170,16 @@ ISC_LOOP_TEST_IMPL(settimeout_belowmin) {
 /* dns_resolver_settimeout over maximum */
 ISC_LOOP_TEST_IMPL(settimeout_overmax) {
        dns_resolver_t *resolver = NULL;
-       unsigned int timeout;
+       unsigned int default_timeout, timeout;
 
        mkres(&resolver);
 
+       default_timeout = dns_resolver_gettimeout(resolver);
        dns_resolver_settimeout(resolver, 4000000);
+
        timeout = dns_resolver_gettimeout(resolver);
-       assert_in_range(timeout, 0, 3999999);
+       assert_in_range(timeout, default_timeout, 3999999);
+
        destroy_resolver(&resolver);
        isc_loopmgr_shutdown(loopmgr);
 }