diff --git a/lib/tasks/zammad/ci/test/prepare.rake b/lib/tasks/zammad/ci/test/prepare.rake new file mode 100644 index 000000000..ceec3c520 --- /dev/null +++ b/lib/tasks/zammad/ci/test/prepare.rake @@ -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 diff --git a/lib/tasks/zammad/ci/test/start.rake b/lib/tasks/zammad/ci/test/start.rake index 646e82adf..f8be78ed5 100644 --- a/lib/tasks/zammad/ci/test/start.rake +++ b/lib/tasks/zammad/ci/test/start.rake @@ -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