From b18049b05706f84d8dcf01ebda5bff6ca268dce4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Tue, 13 Apr 2021 18:10:59 +0200
Subject: [PATCH] Make the 'test' task a no-op and advertise other tasks
 instead
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 Rakefile            |  2 ++
 lib/tasks/test.rake | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Rakefile b/Rakefile
index 445542e5c001f..eb2f158972d5c 100755
--- a/Rakefile
+++ b/Rakefile
@@ -4,6 +4,8 @@
 # Add your own tasks in files placed in lib/tasks ending in .rake,
 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
 
+Rake::TaskManager.record_task_metadata = true
+
 require File.expand_path('config/application', __dir__)
 
 relative_url_conf = File.expand_path('config/initializers/relative_url', __dir__)
diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake
index b24817468c6ee..c4eb9450b31fb 100644
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -2,7 +2,16 @@
 
 Rake::Task["test"].clear
 
-desc "GitLab | Run all tests"
+desc "GitLab | List rake tasks for tests"
 task :test do
-  Rake::Task["gitlab:test"].invoke
+  puts "Running the full GitLab test suite takes significant time to pass. We recommend using one of the following spec tasks:\n\n"
+
+  spec_tasks = Rake::Task.tasks.select { |t| t.name.start_with?('spec:') }
+  longest_task_name = spec_tasks.map { |t| t.name.size }.max
+
+  spec_tasks.each do |task|
+    puts "#{"%-#{longest_task_name}s" % task.name} | #{task.full_comment}"
+  end
+
+  puts "\nLearn more at https://docs.gitlab.com/ee/development/rake_tasks.html#run-tests."
 end
-- 
GitLab