46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
diff -Nur a/cache/stores/mem_cache_store_test.rb b/cache/stores/mem_cache_store_test.rb
|
|
--- a/cache/stores/mem_cache_store_test.rb 2021-08-20 00:25:04.000000000 +0800
|
|
+++ b/cache/stores/mem_cache_store_test.rb 2022-07-05 11:22:22.774850776 +0800
|
|
@@ -17,8 +17,12 @@
|
|
end
|
|
end
|
|
|
|
-class UnavailableDalliServer < Dalli::Server
|
|
- def alive?
|
|
+class UnavailableDalliServer < Dalli::Protocol::Binary
|
|
+ def alive? # before https://github.com/petergoldstein/dalli/pull/863
|
|
+ false
|
|
+ end
|
|
+
|
|
+ def ensure_connected! # after https://github.com/petergoldstein/dalli/pull/863
|
|
false
|
|
end
|
|
end
|
|
@@ -263,17 +267,21 @@
|
|
end
|
|
|
|
def emulating_unavailability
|
|
- old_server = Dalli.send(:remove_const, :Server)
|
|
- Dalli.const_set(:Server, UnavailableDalliServer)
|
|
+ old_server = Dalli::Protocol.send(:remove_const, :Binary)
|
|
+ Dalli::Protocol.const_set(:Binary, UnavailableDalliServer)
|
|
|
|
yield ActiveSupport::Cache::MemCacheStore.new
|
|
ensure
|
|
- Dalli.send(:remove_const, :Server)
|
|
- Dalli.const_set(:Server, old_server)
|
|
+ Dalli::Protocol.send(:remove_const, :Binary)
|
|
+ Dalli::Protocol.const_set(:Binary, old_server)
|
|
end
|
|
|
|
def servers(cache = @cache)
|
|
- client(cache).instance_variable_get(:@servers)
|
|
+ if client(cache).instance_variable_defined?(:@normalized_servers)
|
|
+ client(cache).instance_variable_get(:@normalized_servers)
|
|
+ else
|
|
+ client(cache).instance_variable_get(:@servers)
|
|
+ end
|
|
end
|
|
|
|
def client(cache = @cache)
|