--- /dev/null
+start_server {tags {"repl"}} {
+ start_server {} {
+ test {First server should have role slave after SLAVEOF} {
+ r -1 slaveof [srv 0 host] [srv 0 port]
+ after 1000
+ s -1 role
+ } {slave}
+
+ test {MASTER and SLAVE dataset should be identical after complex ops} {
+ createComplexDataset r 10000
+ after 500
+ 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]
+ }
+ }
+}
--- /dev/null
+start_server {tags {"repl"}} {
+ start_server {} {
+ test {First server should have role slave after SLAVEOF} {
+ r -1 slaveof [srv 0 host] [srv 0 port]
+ after 1000
+ s -1 role
+ } {slave}
+
+ test {MASTER and SLAVE consistency with expire} {
+ createComplexDataset r 50000 useexpire
+ after 4000 ;# Make sure everything expired before taking the digest
+ r keys * ;# Force DEL syntesizing to slave
+ after 1000 ;# Wait another second. Now everything should be fine.
+ 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]
+ }
+ }
+}
after 1000
assert_equal [r debug digest] [r -1 debug digest]
}
-
- test {MASTER and SLAVE dataset should be identical after complex ops} {
- createComplexDataset r 10000
- after 500
- 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]
- }
-
- test {MASTER and SLAVE consistency with expire} {
- createComplexDataset r 50000 useexpire
- after 4000 ;# Make sure everything expired before taking the digest
- r keys * ;# Force DEL syntesizing to slave
- after 1000 ;# Wait another second. Now everything should be fine.
- 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]
- }
}
}
unit/cas
unit/quit
integration/replication
+ integration/replication-2
+ integration/replication-3
integration/aof
unit/pubsub
unit/slowlog
}
# Start the client instances
+ set ::clients_pids {}
for {set j 0} {$j < $::numclients} {incr j} {
- exec tclsh8.5 [info script] {*}$::argv \
- --client $port --port [expr {$::port+($j*10)}] &
+ set p [exec tclsh8.5 [info script] {*}$::argv \
+ --client $port --port [expr {$::port+($j*10)}] &]
+ lappend ::clients_pids $p
}
# Setup global state for the test server
} elseif {$status eq {done}} {
set elapsed [expr {[clock seconds]-$::clients_start_time($fd)}]
puts "\[[colorstr yellow $status]\]: $data ($elapsed seconds)"
- puts "+++ [llength $::active_clients] units still in execution."
+ puts "+++ [expr {[llength $::active_clients]-1}] units still in execution."
lappend ::clients_time_history $elapsed $data
signal_idle_client $fd
} elseif {$status eq {ok}} {
puts "\[[colorstr green $status]\]: $data"
} elseif {$status eq {err}} {
puts "\[[colorstr red $status]\]: $data"
+ } elseif {$status eq {exception}} {
+ puts "\[[colorstr red $status]\]: $data"
+ foreach p $::clients_pids {
+ catch {exec kill -9 $p}
+ }
+ exit 1
} else {
puts "\[$status\]: $data"
}