summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2010-08-03 13:38:39 +0200
committerantirez <antirez@gmail.com>2010-08-03 13:38:39 +0200
commit6146329f1f3381e8daef47463a6588b161f10596 (patch)
tree6a05f6f8ae57bede7457666ba015090f9e7b6eaf
parent23d7298b1594cf673f04f2f8561d4f85b8457c6f (diff)
downloadredis-6146329f1f3381e8daef47463a6588b161f10596.tar.gz
replication test with expires
-rw-r--r--tests/integration/replication.tcl18
-rw-r--r--tests/support/util.tcl9
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl
index 4b2588251..6ca5a6dda 100644
--- a/tests/integration/replication.tcl
+++ b/tests/integration/replication.tcl
@@ -23,6 +23,24 @@ start_server {tags {"repl"}} {
}
assert_equal [r debug digest] [r -1 debug digest]
}
+
+ test {MASTER and SLAVE consistency with expire} {
+ createComplexDataset r 50000 useexpire
+ after 4000 ;# Make sure everything expired before taking the digest
+ if {[r debug digest] ne [r -1 debug digest]} {
+ set csv1 [csvdump r]
+ set csv2 [csvdump {r -1}]
+ set fd [open /tmp/repldump1.txt w]
+ puts -nonewline $fd $csv1
+ close $fd
+ set fd [open /tmp/repldump2.txt w]
+ puts -nonewline $fd $csv2
+ close $fd
+ puts "Master - Slave inconsistency"
+ puts "Run diff -u against /tmp/repldump*.txt for more info"
+ }
+ assert_equal [r debug digest] [r -1 debug digest]
+ }
}
}
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index b9c89aa89..95153111f 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -140,12 +140,19 @@ proc findKeyWithType {r type} {
return {}
}
-proc createComplexDataset {r ops} {
+proc createComplexDataset {r ops {opt {}}} {
for {set j 0} {$j < $ops} {incr j} {
set k [randomKey]
set k2 [randomKey]
set f [randomValue]
set v [randomValue]
+
+ if {[lsearch -exact $opt useexpire] != -1} {
+ if {rand() < 0.1} {
+ {*}$r expire [randomKey] [randomInt 2]
+ }
+ }
+
randpath {
set d [expr {rand()}]
} {