Commit 8a0c5a13 authored by Stan Hu's avatar Stan Hu

Fix Sidekiq testing API warnings in Rake tasks

Running any Rake task would show:

ARNING: Sidekiq testing API enabled, but this is not the test
environment.  Your jobs will not go to Redis.

To fix this, we move the `require` statement into the import task.
Now this message only shows when running the import job.

Closes https://gitlab.com/gitlab-org/gitlab/issues/38377
parent 234e2bdd
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
# @example # @example
# bundle exec rake "gitlab:import_export:import[root, root, imported_project, /path/to/file.tar.gz]" # bundle exec rake "gitlab:import_export:import[root, root, imported_project, /path/to/file.tar.gz]"
# #
require 'sidekiq/testing'
namespace :gitlab do namespace :gitlab do
namespace :import_export do namespace :import_export do
desc 'EXPERIMENTAL | Import large project archives' desc 'EXPERIMENTAL | Import large project archives'
task :import, [:username, :namespace_path, :project_path, :archive_path] => :gitlab_environment do |_t, args| task :import, [:username, :namespace_path, :project_path, :archive_path] => :gitlab_environment do |_t, args|
# Load it here to avoid polluting Rake tasks with Sidekiq test warnings
require 'sidekiq/testing'
warn_user_is_not_gitlab warn_user_is_not_gitlab
if ENV['IMPORT_DEBUG'].present? if ENV['IMPORT_DEBUG'].present?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment