From d211078a27ba75f1dfdcdaf7d407f3370f914974 Mon Sep 17 00:00:00 2001 From: uriyage <78144248+uriyage@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:07:07 +0300 Subject: [PATCH] Fix query buffer resized test flakiness (#646) Added a wait_for_condition to avoid the timing issue. ``` *** [err]: query buffer resized correctly in tests/unit/querybuf.tcl Expected 11 >= 16384 && 11 <= 32770 (context: type eval line 24 cmd {assert {$orig_test_client_qbuf >= 16384 && $orig_test_client_qbuf <= $MAX_QUERY_BUFFER_SIZE}} proc ::test) *** [err]: query buffer resized correctly when not idle in tests/unit/querybuf.tcl Expected 11 > 32768 (context: type eval line 14 cmd {assert {$orig_test_client_qbuf > 32768}} proc ::test) *** [err]: query buffer resized correctly with fat argv in tests/unit/querybuf.tcl query buffer should not be resized when client idle time smaller than 2s ``` Signed-off-by: Uri Yagelnik --- tests/unit/querybuf.tcl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/querybuf.tcl b/tests/unit/querybuf.tcl index 913b993b1..519743d24 100644 --- a/tests/unit/querybuf.tcl +++ b/tests/unit/querybuf.tcl @@ -39,7 +39,13 @@ start_server {tags {"querybuf slow"}} { # Send partial command to client to make sure it doesn't use the shared qb. $rd write "*3\r\n\$3\r\nset\r\n\$2\r\na" $rd flush - after 100 + # Wait for the client to start using a private query buffer. + wait_for_condition 1000 10 { + [client_query_buffer test_client] > 0 + } else { + fail "client should start using a private query buffer" + } + # send the rest of the command $rd write "a\r\n\$1\r\nb\r\n" $rd flush