Skip to content

Commit

Permalink
Stabilize the sentinel suite
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 17, 2022
1 parent 91b087a commit dbfc6cc
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/sentinel/sentinel_command_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class SentinelCommandsTest < Minitest::Test
include Helper::Sentinel

def test_sentinel_command_master
wait_for_quorum

redis = build_sentinel_client
result = redis.sentinel('master', MASTER_NAME)

Expand All @@ -33,6 +35,8 @@ def test_sentinel_command_slaves
end

def test_sentinel_command_sentinels
wait_for_quorum

redis = build_sentinel_client
result = redis.sentinel('sentinels', MASTER_NAME)

Expand All @@ -51,9 +55,25 @@ def test_sentinel_command_get_master_by_name
end

def test_sentinel_command_ckquorum
wait_for_quorum
redis = build_sentinel_client
result = redis.sentinel('ckquorum', MASTER_NAME)
assert_equal result, 'OK X usable Sentinels. Quorum and failover authorization can be reached'
end

assert_equal result, 'OK 3 usable Sentinels. Quorum and failover authorization can be reached'
private

def wait_for_quorum
redis = build_sentinel_client
50.times do
if redis.sentinel('ckquorum', MASTER_NAME).start_with?('OK 3 usable Sentinels')
return
else
sleep 0.1
end
rescue
sleep 0.1
end
raise "ckquorum timeout"
end
end

0 comments on commit dbfc6cc

Please sign in to comment.