aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2019-02-25 16:34:03 +0200
committerbogdanvlviv <bogdanvlviv@gmail.com>2019-02-26 23:19:26 +0000
commita79a5f6efbc54b155d6a50101f10c2c11e3a661d (patch)
treedccb6b046b60f020e676316c14c054d0e4c35241 /activesupport/test
parent572dcdd7e858f126848bdf4f2be0f5cb0de7c026 (diff)
downloadrails-a79a5f6efbc54b155d6a50101f10c2c11e3a661d.tar.gz
rails-a79a5f6efbc54b155d6a50101f10c2c11e3a661d.tar.bz2
rails-a79a5f6efbc54b155d6a50101f10c2c11e3a661d.zip
Run activesupport's memcache store tests on Buildkite
Related to 287920ca7d06c8f51198ec750d65ba703835b257
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/cache/behaviors/connection_pool_behavior.rb4
-rw-r--r--activesupport/test/cache/stores/mem_cache_store_test.rb23
-rw-r--r--activesupport/test/cache/stores/redis_cache_store_test.rb2
3 files changed, 15 insertions, 14 deletions
diff --git a/activesupport/test/cache/behaviors/connection_pool_behavior.rb b/activesupport/test/cache/behaviors/connection_pool_behavior.rb
index 5e66e0b202..aed04d07d4 100644
--- a/activesupport/test/cache/behaviors/connection_pool_behavior.rb
+++ b/activesupport/test/cache/behaviors/connection_pool_behavior.rb
@@ -7,7 +7,7 @@ module ConnectionPoolBehavior
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 @@ module ConnectionPoolBehavior
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
diff --git a/activesupport/test/cache/stores/mem_cache_store_test.rb b/activesupport/test/cache/stores/mem_cache_store_test.rb
index f426a37c66..0e472f5a1a 100644
--- a/activesupport/test/cache/stores/mem_cache_store_test.rb
+++ b/activesupport/test/cache/stores/mem_cache_store_test.rb
@@ -25,8 +25,9 @@ end
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 @@ class MemCacheStoreTest < ActiveSupport::TestCase
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 @@ class MemCacheStoreTest < ActiveSupport::TestCase
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 @@ class MemCacheStoreTest < ActiveSupport::TestCase
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 @@ class MemCacheStoreTest < ActiveSupport::TestCase
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 @@ class MemCacheStoreTest < ActiveSupport::TestCase
private
def store
- :mem_cache_store
+ [:mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"]
end
def emulating_latency
diff --git a/activesupport/test/cache/stores/redis_cache_store_test.rb b/activesupport/test/cache/stores/redis_cache_store_test.rb
index 273b196458..1d87f74347 100644
--- a/activesupport/test/cache/stores/redis_cache_store_test.rb
+++ b/activesupport/test/cache/stores/redis_cache_store_test.rb
@@ -187,7 +187,7 @@ module ActiveSupport::Cache::RedisCacheStoreTests
private
def store
- :redis_cache_store
+ [:redis_cache_store]
end
def emulating_latency