Bug #16529

Require rake/tasktask file when used in Rake test definitions

Added by Dominic Cleal 9 months ago. Updated 9 months ago.

Status:Closed
Priority:Normal
Assigned To:Dominic Cleal
Category:rake tasks
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/3839
Story points-
Velocity based estimate-
Release1.14.0Release relationshipAuto

Description

Under Rails 5, the existing rake task definition files fail to load as the Rake::TaskTask helper isn't available by default:

$ rails foo
rails aborted!
NameError: uninitialized constant Rake::TestTask
/home/dcleal/code/foreman/foreman/lib/tasks/test.rake:3:in `block in <top (required)>'
/home/dcleal/code/foreman/foreman/lib/tasks/test.rake:1:in `<top (required)>'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/engine.rb:654:in `block in run_tasks_blocks'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/engine.rb:654:in `each'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/engine.rb:654:in `run_tasks_blocks'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/application.rb:443:in `run_tasks_blocks'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/engine.rb:457:in `load_tasks'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/railtie.rb:193:in `public_send'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-5.0.0/lib/rails/railtie.rb:193:in `method_missing'
/home/dcleal/code/foreman/foreman/Rakefile:7:in `<top (required)>'

The Rails file that required it originally has had the require removed (https://github.com/rails/rails/commit/8017e6a) as Rails now uses its own helpers. Since Foreman defines additional tasks using Rake, we need to require the file that contains the setup helper we're calling.

Associated revisions

Revision b79ef2a8
Added by Dominic Cleal 9 months ago

fixes #16529 - require rake/testtask explicitly

History

#1 Updated by The Foreman Bot 9 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3839 added

#2 Updated by Dominic Cleal 9 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal 9 months ago

  • Release set to 1.14.0

Also available in: Atom PDF