From 61b7e5916dc9887f97e8c6f0c92af7509b29dbaf Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 16 Mar 2022 14:53:57 +0800 Subject: [PATCH] Fix module redact test for valgrind (#10432) The new module redact test will fail with valgrind: ``` [err]: modules can redact arguments in tests/unit/moduleapi/auth.tcl Expected 'slowlog reset' to be equal to 'auth.redact 1 (redacted) 3 (redacted)' (context: type eval line 12 cmd {assert_equal {slowlog reset} [lindex [lindex [r slowlog get] 2] 3]} proc ::test) ``` The reason is that with `slowlog-log-slower-than 10000`, `slowlog get` will have a chance to exceed 10ms. Made two changes to avoid failure: 1. change `slowlog-log-slower-than` from 10000 to -1, distable it. 2. assert to use the previous execution result. In theory, the second one can actually be left unchanged, but i think it will be better if it is changed. --- tests/unit/moduleapi/auth.tcl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/moduleapi/auth.tcl b/tests/unit/moduleapi/auth.tcl index 32ace6958..c7c2def77 100644 --- a/tests/unit/moduleapi/auth.tcl +++ b/tests/unit/moduleapi/auth.tcl @@ -73,15 +73,15 @@ start_server {tags {"modules"}} { r slowlog reset r auth.redact 1 2 3 4 r auth.redact 1 2 3 - r config set slowlog-log-slower-than 10000 + r config set slowlog-log-slower-than -1 set slowlog_resp [r slowlog get] # There will be 3 records, slowlog reset and the # two auth redact calls. assert_equal 3 [llength $slowlog_resp] - assert_equal {slowlog reset} [lindex [lindex [r slowlog get] 2] 3] - assert_equal {auth.redact 1 (redacted) 3 (redacted)} [lindex [lindex [r slowlog get] 1] 3] - assert_equal {auth.redact (redacted) 2 (redacted)} [lindex [lindex [r slowlog get] 0] 3] + assert_equal {slowlog reset} [lindex [lindex $slowlog_resp 2] 3] + assert_equal {auth.redact 1 (redacted) 3 (redacted)} [lindex [lindex $slowlog_resp 1] 3] + assert_equal {auth.redact (redacted) 2 (redacted)} [lindex [lindex $slowlog_resp 0] 3] } test "Unload the module - testacl" {