From d67e66de72edc49a5493c963fd7cb97411165d8c Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Wed, 19 May 2021 16:06:43 +0300 Subject: [PATCH] Fix race in new lazyfree test (#8965) I recently saw this failure: [err]: lazy free a stream with all types of metadata in tests/unit/lazyfree.tcl Expected '2' to be equal to '1' (context: type eval line 23 cmd {assert_equal [s lazyfreed_objects] 1} proc ::test) The only explanation for such a thing is that the async flushdb wasn't done before we did the resetstat --- tests/unit/lazyfree.tcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/lazyfree.tcl b/tests/unit/lazyfree.tcl index ab82d0625..95c4c5426 100644 --- a/tests/unit/lazyfree.tcl +++ b/tests/unit/lazyfree.tcl @@ -38,6 +38,13 @@ start_server {tags {"lazyfree"}} { } test "lazy free a stream with all types of metadata" { + # make the previous test is really done before doing RESETSTAT + wait_for_condition 5 100 { + [s lazyfree_pending_objects] == 0 + } else { + fail "lazyfree isn't done" + } + r config resetstat r config set stream-node-max-entries 5 for {set j 0} {$j < 1000} {incr j} {