test_fail
}
-# Leave some time (100ms) for the synchronisation
-&Tmp-String-0 := `/bin/sleep 0.1`
+# Leave some time (500ms) for the synchronisation
+%(delay:0.5)
# Note the current master
&Tmp-String-1 := %(redis_node:b 0)
+# Note the current replica
+&Tmp-String-2 := %(redis_node:b 1)
+
# Cause one of the redis cluster nodes to SEGV
if ("%(redis:@%(redis_node:b 0) DEBUG SEGFAULT)" != '') {
test_fail
}
# Forcefully failover the slave for that node
-if (!("%(redis:@%(redis_node:b 1) CLUSTER FAILOVER TAKEOVER)" == 'OK')) {
+if (!("%(redis:@%{Tmp-String-2} CLUSTER FAILOVER TAKEOVER)" == 'OK')) {
test_fail
}
# Allow time for the takeover to propagate to other nodes
foreach &control.Tmp-Integer-0 {
- if (%(redis_node:b 0) != &Tmp-String-1) {
+ # Keep remapping the cluster
+ %(redis_remap:%{Tmp-String-2})
+
+ if (%(redis_node:b 0) == &Tmp-String-2) {
break
}
- &Tmp-String-0 := `/bin/sleep 0.5`
+ %(delay:0.5)
}
if (!("%(redis:GET b)" == 'boom')) {
}
# No alternatives...
+%(delay:0.5)
if ("%(redis:GET b)" == 'boom') {
test_fail
}