1
0

11-manual-takeover.tcl 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Manual takeover test
  2. source "../tests/includes/init-tests.tcl"
  3. test "Create a 5 nodes cluster" {
  4. create_cluster 5 5
  5. }
  6. test "Cluster is up" {
  7. assert_cluster_state ok
  8. }
  9. test "Cluster is writable" {
  10. cluster_write_test 0
  11. }
  12. test "Killing majority of master nodes" {
  13. kill_instance redis 0
  14. kill_instance redis 1
  15. kill_instance redis 2
  16. }
  17. test "Cluster should eventually be down" {
  18. assert_cluster_state fail
  19. }
  20. test "Use takeover to bring slaves back" {
  21. R 5 cluster failover takeover
  22. R 6 cluster failover takeover
  23. R 7 cluster failover takeover
  24. }
  25. test "Cluster should eventually be up again" {
  26. assert_cluster_state ok
  27. }
  28. test "Cluster is writable" {
  29. cluster_write_test 4
  30. }
  31. test "Instance #5, #6, #7 are now masters" {
  32. assert {[RI 5 role] eq {master}}
  33. assert {[RI 6 role] eq {master}}
  34. assert {[RI 7 role] eq {master}}
  35. }
  36. test "Restarting the previously killed master nodes" {
  37. restart_instance redis 0
  38. restart_instance redis 1
  39. restart_instance redis 2
  40. }
  41. test "Instance #0, #1, #2 gets converted into a slaves" {
  42. wait_for_condition 1000 50 {
  43. [RI 0 role] eq {slave} && [RI 1 role] eq {slave} && [RI 2 role] eq {slave}
  44. } else {
  45. fail "Old masters not converted into slaves"
  46. }
  47. }