From fb8a0ad373f4f4e8961bcc256832dc5d86fdd5f2 Mon Sep 17 00:00:00 2001 From: Vivek Saini Date: Tue, 3 May 2022 00:41:30 +0000 Subject: [PATCH] Quick fix to make psync tests work --- tests/helpers/gen_climbing_load.tcl | 18 ++++++++++++++++++ .../replication-psync-multimaster.tcl | 8 ++++---- tests/support/util.tcl | 9 +++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/helpers/gen_climbing_load.tcl diff --git a/tests/helpers/gen_climbing_load.tcl b/tests/helpers/gen_climbing_load.tcl new file mode 100644 index 000000000..b8fa1936e --- /dev/null +++ b/tests/helpers/gen_climbing_load.tcl @@ -0,0 +1,18 @@ +source tests/support/keydb.tcl + + +set ::tlsdir "tests/tls" + +proc gen_climbing_load {host port db ops tls} { + set start_time [clock seconds] + set r [redis $host $port 1 $tls] + $r client setname LOAD_HANDLER + $r select $db + set x 0 + while {$x < $ops} { + incr x + $r set [expr $x] [expr rand()] + } +} + +gen_climbing_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] diff --git a/tests/integration/replication-psync-multimaster.tcl b/tests/integration/replication-psync-multimaster.tcl index 4d52f13a1..90c3c0711 100644 --- a/tests/integration/replication-psync-multimaster.tcl +++ b/tests/integration/replication-psync-multimaster.tcl @@ -76,9 +76,9 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl reco } } } - stop_bg_complex_data $load_handle0 - stop_bg_complex_data $load_handle1 - stop_bg_complex_data $load_handle2 + stop_climbing_load $load_handle0 + stop_climbing_load $load_handle1 + stop_climbing_load $load_handle2 # Wait for the replica to reach the "online" # state from the POV of the master. @@ -147,4 +147,4 @@ foreach mdl {no yes} { assert {[s -1 sync_partial_err] > 0} } $mdl $sdl 1 } -} +} \ No newline at end of file diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 156f6f811..ffe8d0d0f 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -543,11 +543,20 @@ proc start_bg_complex_data {host port db ops} { exec $tclsh tests/helpers/bg_complex_data.tcl $host $port $db $ops $::tls & } +proc start_climbing_load {host port db ops} { + set tclsh [info nameofexecutable] + exec $tclsh tests/helpers/gen_climbing_load.tcl $host $port $db $ops $::tls & +} + # Stop a process generating write load executed with start_bg_complex_data. proc stop_bg_complex_data {handle} { catch {exec /bin/kill -9 $handle} } +proc stop_climbing_load {handle} { + catch {exec /bin/kill -9 $handle} +} + proc populate {num prefix size} { set rd [redis_deferring_client] for {set j 0} {$j < $num} {incr j} {