From 37559ca79fe621385f4ebc5f692e13677f93fb93 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Tue, 26 Oct 2021 13:02:31 +0300 Subject: [PATCH] Fix race condition in lazy free test (#9682) The first test exited before all the memory was reclaimed, so when the second test sampled used_memory, it was too early. --- tests/unit/lazyfree.tcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/lazyfree.tcl b/tests/unit/lazyfree.tcl index 78286cc8a..eccba01b7 100644 --- a/tests/unit/lazyfree.tcl +++ b/tests/unit/lazyfree.tcl @@ -19,6 +19,13 @@ start_server {tags {"lazyfree"}} { } test "FLUSHDB ASYNC can reclaim memory in background" { + # make the previous test is really done before sampling used_memory + wait_for_condition 50 100 { + [s lazyfree_pending_objects] == 0 + } else { + fail "lazyfree isn't done" + } + set orig_mem [s used_memory] set args {} for {set i 0} {$i < 100000} {incr i} {