1# Check cluster info stats 2 3source "../tests/includes/init-tests.tcl" 4 5test "Create a primary with a replica" { 6 create_cluster 2 0 7} 8 9test "Cluster should start ok" { 10 assert_cluster_state ok 11} 12 13set primary1 [Rn 0] 14set primary2 [Rn 1] 15 16proc cmdstat {instance cmd} { 17 return [cmdrstat $cmd $instance] 18} 19 20proc errorstat {instance cmd} { 21 return [errorrstat $cmd $instance] 22} 23 24test "errorstats: rejected call due to MOVED Redirection" { 25 $primary1 config resetstat 26 $primary2 config resetstat 27 assert_match {} [errorstat $primary1 MOVED] 28 assert_match {} [errorstat $primary2 MOVED] 29 # we know that one will have a MOVED reply and one will succeed 30 catch {$primary1 set key b} replyP1 31 catch {$primary2 set key b} replyP2 32 # sort servers so we know which one failed 33 if {$replyP1 eq {OK}} { 34 assert_match {MOVED*} $replyP2 35 set pok $primary1 36 set perr $primary2 37 } else { 38 assert_match {MOVED*} $replyP1 39 set pok $primary2 40 set perr $primary1 41 } 42 assert_match {} [errorstat $pok MOVED] 43 assert_match {*count=1*} [errorstat $perr MOVED] 44 assert_match {*calls=0,*,rejected_calls=1,failed_calls=0} [cmdstat $perr set] 45} 46