From fa15c1fb232e7e91f47808069b1ab22016a3f386 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Thu, 6 Jun 2024 19:58:57 +0000 Subject: [PATCH] Update the resolver unit test 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. (cherry picked from commit 63b787effe3171c87a526c60ab9766a1e6a52bf1) --- tests/dns/resolver_test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/dns/resolver_test.c b/tests/dns/resolver_test.c index 3f53f9f351..f53cfd684a 100644 --- a/tests/dns/resolver_test.c +++ b/tests/dns/resolver_test.c @@ -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); }