mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Eagerly close Dalli connections in MemCachedStoreTest
Otherwise the test suite is flaky when ran repeatedly on the same machine because of file descriptors exhaustion.
This commit is contained in:
parent
6e9f9b46b9
commit
738ca3595f
1 changed files with 12 additions and 1 deletions
|
@ -36,7 +36,9 @@ class MemCacheStoreTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def lookup_store(options = {})
|
||||
ActiveSupport::Cache.lookup_store(*store, { namespace: @namespace }.merge(options))
|
||||
cache = ActiveSupport::Cache.lookup_store(*store, { namespace: @namespace }.merge(options))
|
||||
(@_stores ||= []) << cache
|
||||
cache
|
||||
end
|
||||
|
||||
def setup
|
||||
|
@ -48,6 +50,15 @@ class MemCacheStoreTest < ActiveSupport::TestCase
|
|||
@cache.logger = ActiveSupport::Logger.new(File::NULL)
|
||||
end
|
||||
|
||||
def after_teardown
|
||||
stores, @_stores = @_stores, []
|
||||
stores.each do |store|
|
||||
# Eagerly closing Dalli connection avoid file descriptor exhaustion.
|
||||
# Otherwise the test suite is flaky when ran repeatedly
|
||||
store.instance_variable_get(:@data).close
|
||||
end
|
||||
end
|
||||
|
||||
include CacheStoreBehavior
|
||||
include CacheStoreVersionBehavior
|
||||
include CacheStoreCoderBehavior
|
||||
|
|
Loading…
Reference in a new issue