From fdfb1ca972da94828b888a3de01c4819438c362e Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 3 Dec 2018 12:38:01 +0100 Subject: [PATCH] Refactoring: Splitted Rake CI Test start task up and created new prepare job which can be re-used. --- lib/tasks/zammad/ci/test/prepare.rake | 23 +++++++++++++++++++++++ lib/tasks/zammad/ci/test/start.rake | 12 +----------- 2 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 lib/tasks/zammad/ci/test/prepare.rake 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