Run activesupport's memcache store tests on Buildkite

Related to 287920ca7d06c8f51198ec750d65ba703835b257
This commit is contained in:
bogdanvlviv 2019-02-25 16:34:03 +02:00
parent 572dcdd7e8
commit a79a5f6efb
No known key found for this signature in database
GPG Key ID: E4ACD76A6DB6DFDD
3 changed files with 15 additions and 14 deletions

@ -7,7 +7,7 @@ def test_connection_pool
threads = []
emulating_latency do
cache = ActiveSupport::Cache.lookup_store(store, { pool_size: 2, pool_timeout: 1 }.merge(store_options))
cache = ActiveSupport::Cache.lookup_store(*store, { pool_size: 2, pool_timeout: 1 }.merge(store_options))
cache.clear
assert_raises Timeout::Error do
@ -32,7 +32,7 @@ def test_no_connection_pool
threads = []
emulating_latency do
cache = ActiveSupport::Cache.lookup_store(store, store_options)
cache = ActiveSupport::Cache.lookup_store(*store, store_options)
cache.clear
assert_nothing_raised do

@ -25,8 +25,9 @@ def alive?
class MemCacheStoreTest < ActiveSupport::TestCase
begin
ss = Dalli::Client.new("localhost:11211").stats
raise Dalli::DalliError unless ss["localhost:11211"]
servers = ENV["MEMCACHE_SERVERS"] || "localhost:11211"
ss = Dalli::Client.new(servers).stats
raise Dalli::DalliError unless ss[servers]
MEMCACHE_UP = true
rescue Dalli::DalliError
@ -37,8 +38,8 @@ class MemCacheStoreTest < ActiveSupport::TestCase
def setup
skip "memcache server is not up" unless MEMCACHE_UP
@cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, expires_in: 60)
@peek = ActiveSupport::Cache.lookup_store(:mem_cache_store)
@cache = ActiveSupport::Cache.lookup_store(*store, expires_in: 60)
@peek = ActiveSupport::Cache.lookup_store(*store)
@data = @cache.instance_variable_get(:@data)
@cache.clear
@cache.silence!
@ -56,21 +57,21 @@ def setup
include FailureSafetyBehavior
def test_raw_values
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
cache.write("foo", 2)
assert_equal "2", cache.read("foo")
end
def test_raw_values_with_marshal
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
cache.write("foo", Marshal.dump([]))
assert_equal [], cache.read("foo")
end
def test_local_cache_raw_values
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
cache.with_local_cache do
cache.write("foo", 2)
@ -79,7 +80,7 @@ def test_local_cache_raw_values
end
def test_increment_expires_in
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
assert_called_with cache.instance_variable_get(:@data), :incr, [ "foo", 1, 60 ] do
cache.increment("foo", 1, expires_in: 60)
@ -87,7 +88,7 @@ def test_increment_expires_in
end
def test_decrement_expires_in
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
assert_called_with cache.instance_variable_get(:@data), :decr, [ "foo", 1, 60 ] do
cache.decrement("foo", 1, expires_in: 60)
@ -95,7 +96,7 @@ def test_decrement_expires_in
end
def test_local_cache_raw_values_with_marshal
cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, raw: true)
cache = ActiveSupport::Cache.lookup_store(*store, raw: true)
cache.clear
cache.with_local_cache do
cache.write("foo", Marshal.dump([]))
@ -114,7 +115,7 @@ def test_read_should_return_a_different_object_id_each_time_it_is_called
private
def store
:mem_cache_store
[:mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"]
end
def emulating_latency

@ -187,7 +187,7 @@ class ConnectionPoolBehaviourTest < StoreTest
private
def store
:redis_cache_store
[:redis_cache_store]
end
def emulating_latency