Merge pull request #6598 from oranagra/module-hook-test

try to fix an unstable test (module hook for loading progress)
This commit is contained in:
Salvatore Sanfilippo 2019-11-25 17:54:21 +01:00 committed by GitHub
commit a1b654819c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,7 @@
set testmodule [file normalize tests/modules/hooks.so] set testmodule [file normalize tests/modules/hooks.so]
tags "modules" { tags "modules" {
start_server {} { start_server [list overrides [list loadmodule "$testmodule" appendonly yes]] {
r module load $testmodule
r config set appendonly yes
test {Test clients connection / disconnection hooks} { test {Test clients connection / disconnection hooks} {
for {set j 0} {$j < 2} {incr j} { for {set j 0} {$j < 2} {incr j} {
@ -44,15 +42,19 @@ tags "modules" {
r set "bar$j" x r set "bar$j" x
} }
# set some configs that will cause many loading progress events during aof loading # set some configs that will cause many loading progress events during aof loading
r config set key-load-delay 1 r config set key-load-delay 500
r config set dynamic-hz no r config set dynamic-hz no
r config set hz 500 r config set hz 500
r DEBUG LOADAOF r DEBUG LOADAOF
assert_equal [r hooks.event_last loading-aof-start] 0 assert_equal [r hooks.event_last loading-aof-start] 0
assert_equal [r hooks.event_last loading-end] 0 assert_equal [r hooks.event_last loading-end] 0
assert {[r hooks.event_count loading-rdb-start] == 0} assert {[r hooks.event_count loading-rdb-start] == 0}
assert {[r hooks.event_count loading-progress-rdb] >= 2} ;# comes from the preamble section assert_lessthan 2 [r hooks.event_count loading-progress-rdb] ;# comes from the preamble section
assert {[r hooks.event_count loading-progress-aof] >= 2} assert_lessthan 2 [r hooks.event_count loading-progress-aof]
if {$::verbose} {
puts "rdb progress events [r hooks.event_count loading-progress-rdb]"
puts "aof progress events [r hooks.event_count loading-progress-aof]"
}
} }
# undo configs before next test # undo configs before next test
r config set dynamic-hz yes r config set dynamic-hz yes