From d5f1e4b0b5845b31b147569f1086d4375c32a919 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 25 Jun 2013 15:49:07 +0200 Subject: [PATCH] Test: add some AOF testing to EVALSHA replication test. --- tests/integration/replication-3.tcl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/integration/replication-3.tcl b/tests/integration/replication-3.tcl index 48ffc6ec..0fcbad45 100644 --- a/tests/integration/replication-3.tcl +++ b/tests/integration/replication-3.tcl @@ -46,6 +46,10 @@ start_server {tags {"repl"}} { set numops 20000 ;# Enough to trigger the Script Cache LRU eviction. + # While we are at it, enable AOF to test it will be consistent as well + # after the test. + r config set appendonly yes + test {MASTER and SLAVE consistency with EVALSHA replication} { array set oldsha {} for {set j 0} {$j < $numops} {incr j} { @@ -60,6 +64,13 @@ start_server {tags {"repl"}} { # Additionally call one of the old scripts as well, at random. set res [r evalsha $oldsha([randomInt $j]) 0] assert {$res > 2} + + # Trigger an AOF rewrite while we are half-way, this also + # forces the flush of the script cache, and we will cover + # more code as a result. + if {$j == $numops / 2} { + catch {r bgrewriteaof} + } } wait_for_condition 50 100 { @@ -79,6 +90,12 @@ start_server {tags {"repl"}} { puts "Run diff -u against /tmp/repldump*.txt for more info" } + + set old_digest [r debug digest] + r config set appendonly no + r debug loadaof + set new_digest [r debug digest] + assert {$old_digest eq $new_digest} } } }