Skip to content

Commit

Permalink
tests: Fix concurrency test falkiness from unintentional key overlap (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanahsmith authored Apr 8, 2021
1 parent 113c79a commit d0e8d7e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/unit/concurrency_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def test_threads_with_noblock
Thread.new do
thread_cache = cache.clone
100.times do |i|
thread_cache.set("foo#{n}#{i}", "v#{n}")
thread_cache.set("foo#{n}-#{i}", "v#{n}")
end
assert_equal "v#{n}", thread_cache.get("foo#{n}2")
assert_equal "v#{n}", thread_cache.get("foo#{n}-2")
end
end.each(&:join)
end
Expand All @@ -32,9 +32,9 @@ def test_threads_with_binary
Thread.new do
thread_cache = binary_protocol_cache.clone
100.times do |i|
thread_cache.set("foo#{n}#{i}", "v#{n}")
thread_cache.set("foo#{n}-#{i}", "v#{n}")
end
assert_equal "v#{n}", thread_cache.get("foo#{n}2")
assert_equal "v#{n}", thread_cache.get("foo#{n}-2")
end
end.each(&:join)
end
Expand All @@ -45,8 +45,8 @@ def test_threads_with_multi_get
Thread.new do
thread_cache = binary_protocol_cache.clone
keys = Array.new(100) do |i|
thread_cache.set("foo#{n}#{i}", "v#{n}")
"foo#{n}#{i}"
thread_cache.set("foo#{n}-#{i}", "v#{n}")
"foo#{n}-#{i}"
end
assert_equal Array.new(100) { "v#{n}" }, thread_cache.get_multi(keys).values
end
Expand Down

0 comments on commit d0e8d7e

Please sign in to comment.