Refactoring: Splitted Rake CI Test start task up and created new prepare job which can be re-used.

This commit is contained in:
Thorsten Eckel 2018-12-03 12:38:01 +01:00
parent 030f80e3eb
commit fdfb1ca972
2 changed files with 24 additions and 11 deletions

View file

@ -0,0 +1,23 @@
namespace :zammad do
namespace :ci do
namespace :test do
desc 'Prepares Zammad system for CI env'
task :prepare, [:elasticsearch] do |_task, args|
ENV['RAILS_ENV'] ||= 'production'
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = 'true'
# we have to enforce the env
# otherwise it will fallback to default (develop)
Rails.env = ENV['RAILS_ENV']
Rake::Task['zammad:flush:cache'].invoke
Rake::Task['zammad:db:init'].invoke
Rake::Task['zammad:ci:settings'].invoke(args[:elasticsearch])
end
end
end
end

View file

@ -6,17 +6,7 @@ namespace :zammad do
desc 'Starts all of Zammads services for CI test'
task :start, [:elasticsearch] do |_task, args|
ENV['RAILS_ENV'] ||= 'production'
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = 'true'
# we have to enforce the env
# otherwise it will fallback to default (develop)
Rails.env = ENV['RAILS_ENV']
Rake::Task['zammad:flush:cache'].invoke
Rake::Task['zammad:db:init'].invoke
Rake::Task['zammad:ci:settings'].invoke(args[:elasticsearch])
Rake::Task['zammad:ci:test:prepare'].invoke(args[:elasticsearch])
Rake::Task['zammad:ci:app:start'].invoke
end
end