]> git.saurik.com Git - redis.git/blame - tests/integration/replication.tcl
First implementation of a replication consistency test
[redis.git] / tests / integration / replication.tcl
CommitLineData
8b654e54 1start_server {tags {"repl"}} {
2 start_server {} {
3 test {First server should have role slave after SLAVEOF} {
4 r -1 slaveof [srv 0 host] [srv 0 port]
5 after 1000
6 s -1 role
7 } {slave}
8
9 test {MASTER and SLAVE dataset should be identical after complex ops} {
10 createComplexDataset r 10000
11 assert_equal [r debug digest] [r -1 debug digest]
12 }
13 }
14}
15
7f7499ee 16start_server {tags {"repl"}} {
85ecc65e
PN
17 r set mykey foo
18
9e5d2e8b 19 start_server {} {
85ecc65e
PN
20 test {Second server should have role master at first} {
21 s role
22 } {master}
23
24 test {SLAVEOF should start with link status "down"} {
25 r slaveof [srv -1 host] [srv -1 port]
26 s master_link_status
27 } {down}
28
29 test {The role should immediately be changed to "slave"} {
30 s role
31 } {slave}
32
33 wait_for_sync r
34 test {Sync should have transferred keys from master} {
35 r get mykey
36 } {foo}
37
38 test {The link status should be up} {
39 s master_link_status
40 } {up}
41
42 test {SET on the master should immediately propagate} {
43 r -1 set mykey bar
44 r 0 get mykey
45 } {bar}
46 }
47}