Use `Dalli::Protocol::Binary` instead of deprecated `Dalli::Server`

This commit addresses these failures with Dalli 3.0.1, which loses Dalli 2.x support.

```ruby
$ bin/test test/cache/stores/mem_cache_store_test.rb -n test_fetch_read_failure_returns_nil
Run options: -n test_fetch_read_failure_returns_nil --seed 2554

F

Failure:
OptimizedMemCacheStoreTest#test_fetch_read_failure_returns_nil [/home/yahonda/src/github.com/rails/rails/activesupport/test/cache/behaviors/failure_safety_behavior.rb:8]:
Expected "bar" to be nil.

bin/test test/cache/behaviors/failure_safety_behavior.rb:4

F

Failure:
MemCacheStoreTest#test_fetch_read_failure_returns_nil [/home/yahonda/src/github.com/rails/rails/activesupport/test/cache/behaviors/failure_safety_behavior.rb:8]:
Expected "bar" to be nil.

bin/test test/cache/behaviors/failure_safety_behavior.rb:4

Finished in 0.010229s, 195.5206 runs/s, 195.5206 assertions/s.
2 runs, 2 assertions, 2 failures, 0 errors, 0 skips
$
```
This commit is contained in:
Yasuo Honda 2021-10-14 20:01:27 +09:00 committed by GitHub
parent 2f8db2db0e
commit 370ef3d5b6
1 changed files with 4 additions and 4 deletions

View File

@ -288,13 +288,13 @@ class MemCacheStoreTest < ActiveSupport::TestCase
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)