0
전체/spec 디렉토리를 실행할 때 지난 이틀 동안이 오류가 발생했습니다. 내 테스트 상태에 대해 아무 것도 밝히지 않을지 의심 스럽다. 그것은 무작위로 발생한다. 내 직감은 rails_helper.rb
의 구성 문제 일 수 있습니다.Rails 5.1, Errno :: EMFILE : 열린 파일이 너무 많음 - getcwd
Errno::EMFILE:
Too many open files - getcwd
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:115:in `expand_path'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:115:in `path'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:146:in `exists?'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:95:in `size'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:137:in `empty?'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/uploader/cache.rb:131:in `cache!'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/mount.rb:329:in `cache'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-0.11.2/lib/carrierwave/mount.rb:163:in `attachment='
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/carrierwave-base64-2.5.3/lib/carrierwave/base64/adapter.rb:26:in `block in mount_base64_uploader'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:5:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:33:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute/association.rb:19:in `block in to_proc'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `instance_exec'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `block in define_attribute'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:56:in `get'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:5:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:33:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute/association.rb:19:in `block in to_proc'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `instance_exec'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `block in define_attribute'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:56:in `get'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:5:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:33:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute/association.rb:19:in `block in to_proc'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `instance_exec'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `block in define_attribute'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:56:in `get'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:5:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:33:in `association'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute/association.rb:19:in `block in to_proc'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `instance_exec'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluator.rb:77:in `block in define_attribute'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:56:in `get'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.2/lib/active_support/notifications.rb:168:in `instrument'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /Users/fred/.rvm/gems/ruby-2.4.1/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
스택 추적은 항상 동일합니다. 파일이 열리는 코드에서 어디에서나 명시 적으로 볼 수 없습니다.
나는 최근에 다음과 같은 옵션 DatabaseCleaner을 구현 것 :
config.use_transactional_fixtures = false
config.before(:each) do
Sidekiq::Worker.clear_all
end
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
RedisCache.new.flushdb
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end