1 start_server
{tags
{"repl"}} {
3 test
{First server should have role slave
after SLAVEOF
} {
4 r
-1 slaveof
[srv
0 host
] [srv
0 port
]
9 test
{MASTER and SLAVE dataset should be identical
after complex ops
} {
10 createComplexDataset r
10000
12 if {[r debug digest
] ne
[r
-1 debug digest
]} {
14 set csv2
[csvdump
{r
-1}]
15 set fd
[open /tmp
/repldump1.txt w
]
16 puts -nonewline $fd $csv1
18 set fd
[open /tmp
/repldump2.txt w
]
19 puts -nonewline $fd $csv2
21 puts "Master - Slave inconsistency"
22 puts "Run diff -u against /tmp/repldump*.txt for more info"
24 assert_equal
[r debug digest
] [r
-1 debug digest
]
27 test
{MASTER and SLAVE consistency with expire
} {
28 createComplexDataset r
50000 useexpire
29 after 4000 ;# Make sure everything expired before taking the digest
30 r keys
* ;# Force DEL syntesizing to slave
31 after 1000 ;# Wait another second. Now everything should be fine.
32 if {[r debug digest
] ne
[r
-1 debug digest
]} {
34 set csv2
[csvdump
{r
-1}]
35 set fd
[open /tmp
/repldump1.txt w
]
36 puts -nonewline $fd $csv1
38 set fd
[open /tmp
/repldump2.txt w
]
39 puts -nonewline $fd $csv2
41 puts "Master - Slave inconsistency"
42 puts "Run diff -u against /tmp/repldump*.txt for more info"
44 assert_equal
[r debug digest
] [r
-1 debug digest
]
49 start_server
{tags
{"repl"}} {
53 test
{Second server should have role master at first
} {
57 test
{SLAVEOF should start with link status
"down"} {
58 r slaveof
[srv
-1 host
] [srv
-1 port
]
62 test
{The role should immediately be changed to
"slave"} {
67 test
{Sync should have transferred keys from master
} {
71 test
{The link status should be up
} {
75 test
{SET on the master should immediately propagate
} {