Skip to content

Commit

Permalink
Update sentinel tests to account for the password being preserved
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 9, 2023
1 parent af70deb commit effadaa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/sentinel/sentinel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_sentinel_with_non_sentinel_options
end
end

assert_equal [%w[get-master-addr-by-name master1], ["sentinels", "master1"]], commands[:s1]
assert_equal [%w[auth foo], %w[get-master-addr-by-name master1], ["sentinels", "master1"]], commands[:s1]
assert_equal [%w[auth foo], %w[role]], commands[:m1]
end

Expand Down Expand Up @@ -409,12 +409,15 @@ def test_sentinel_retries

connections = []

fails = Hash.new(0)

handler = lambda do |id, port|
{
sentinel: lambda do |command, *_args|
connections << id

if connections.count(id) < 2
if fails[id] < 2
fails[id] += 1
:close
else
case command
Expand Down Expand Up @@ -451,9 +454,10 @@ def test_sentinel_retries
end
end

assert_equal %i[s1 s2 s1 s1], connections
assert_equal %i[s1 s1 s2 s2 s1 s1], connections

connections.clear
fails.clear

ex = assert_raises(Redis::CannotConnectError) do
RedisMock.start(master) do |master_port|
Expand Down

0 comments on commit effadaa

Please sign in to comment.