DEFRA / waste-carriers-frontend

Waste Carrier Registrations Frontend Code
Other
1 stars 1 forks source link

Fix Perf. test rake task breaking cap deploy #147

Closed Cruikshanks closed 6 years ago

Cruikshanks commented 6 years ago

In our new AWS environment the frontend will be deployed using Capistrano. However it is currently failing with the following error

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ubuntu@DEVWCRBESSRV001: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
LoadError: cannot load such file -- faker
/srv/ruby/waste-carriers-frontend/shared/bundle/ruby/2.4.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/srv/ruby/waste-carriers-frontend/shared/bundle/ruby/2.4.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
/srv/ruby/waste-carriers-frontend/shared/bundle/ruby/2.4.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
/srv/ruby/waste-carriers-frontend/shared/bundle/ruby/2.4.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/srv/ruby/waste-carriers-frontend/releases/20180808133756/lib/tasks/performance_testing.rake:1:in `<top (required)>'
...

The reason is that the performance_testing.rake task is attempting to require gems that are not specified in the production group in the Gemfile. When cap deploys it calls assets:precompile with the environment set to production.

This change ensures that the task is not included if the environment is production.