test/client_test.rb in suo-0.1.1 vs test/client_test.rb in suo-0.1.2
- old
+ new
@@ -22,10 +22,11 @@
assert_nil lock2
@klass.unlock(TEST_KEY, lock1, client: @klass_client)
locked = @klass.locked?(TEST_KEY, 1, client: @klass_client)
+
assert_equal false, locked
end
def test_class_multiple_resource_locking
lock1 = @klass.lock(TEST_KEY, 2, client: @klass_client)
@@ -72,12 +73,12 @@
success_counter = Queue.new
failure_counter = Queue.new
100.times.map do |i|
Thread.new do
- success = @client.lock(TEST_KEY, 50, retry_timeout: 0.9) do
- sleep(1)
+ success = @client.lock(TEST_KEY, 50, retry_timeout: 0.5) do
+ sleep(2)
success_counter << i
end
failure_counter << i unless success
end
@@ -92,11 +93,11 @@
failure_counter = Queue.new
100.times.map do |i|
Thread.new do
success = @client.lock(TEST_KEY, 50, retry_timeout: 2) do
- sleep(1)
+ sleep(0.5)
success_counter << i
end
failure_counter << i unless success
end
@@ -112,10 +113,10 @@
@klass = Suo::Client::Base
end
def test_not_implemented
assert_raises(NotImplementedError) do
- @klass.lock(TEST_KEY, 1)
+ @klass.send(:get, TEST_KEY, {})
end
end
end
class TestMemcachedClient < Minitest::Test