From b983c77d46a2589e483f3bded720fb89c7a3412f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 24 Aug 2020 17:47:29 +0200 Subject: [PATCH] tests: fine tune integration test for GC TL;DR: tune the test - now it works quite reliably for me, though it's perhaps not nice. With 1 MiB cache it's not easy to avoid overflows, as the defaults are meant for much larger sizes. Normal GC target is to decrease usage by 10% when above 80% in 100 records per transaction. That just won't work reliable due to 10% being only 25 pages. This commit makes the test run GC with more suitable tuning and frequently pauses kresd to give GC better chance to catch up. --- tests/config/test_dns_generators.lua | 2 ++ utils/cache_gc/test.integr/deckard.yaml | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/config/test_dns_generators.lua b/tests/config/test_dns_generators.lua index 176137e0f..4a7cc0a58 100644 --- a/tests/config/test_dns_generators.lua +++ b/tests/config/test_dns_generators.lua @@ -99,6 +99,7 @@ local function add_random_rrset() assert(kr_cach:insert(kr_rrset, nil, ffi.C.KR_RANK_SECURE)) end +ffi.cdef('int usleep(uint32_t usec);') -- at least in current glibc it's always 32-bit local rr_count = 0 local function gen_batch() @@ -110,6 +111,7 @@ local function gen_batch() end end kr_cach:commit() + ffi.C.usleep(15) -- stop *whole process* to give better chance to GC executing local delay if math.random(1,4) == 1 then delay = 1 -- give a chance to DNS resolving diff --git a/utils/cache_gc/test.integr/deckard.yaml b/utils/cache_gc/test.integr/deckard.yaml index 65947a795..b1a8b1589 100644 --- a/utils/cache_gc/test.integr/deckard.yaml +++ b/utils/cache_gc/test.integr/deckard.yaml @@ -25,8 +25,11 @@ programs: - name: gc binary: kres-cache-gc additional: - - -d - - "1" + # small cache needs shorter RW transactions and larger "percentages" + - -l8 + - -u50 + - -f20 + - -d1 - -c - ../kresd1/ conncheck: False -- 2.47.2