require"cases/helper"moduleActiveRecordmoduleConnectionAdaptersclassConnectionPoolTest<ActiveRecord::TestCasedeftest_clear_stale_cached_connections!pool=ConnectionPool.newActiveRecord::Base.connection_pool.specthreads=[Thread.new{pool.connection},Thread.new{pool.connection}]threads.map{|t|t.join}pool.extendModule.new{attr_accessor:checkinsdefcheckinconn@checkins<<connconn.object_idend}pool.checkins=[]cleared_threads=pool.clear_stale_cached_connections!assert((cleared_threads-threads.map{|x|x.object_id}).empty?,"threads should have been removed")assert_equalpool.checkins.length,threads.lengthendendendend