Skip to content

TestFileFinder: Map rake tasks to its respective specs

Peter Leitzen requested to merge pl-rake-spec-mapping into master

What does this MR do and why?

This MR adjusts the mapping of TestFileFinder (tff) in tests.yml to map rake tasks located in lib/tasks/**/*.rake to match spec/tasks/**/*_rake_spec.rb for both FOSS and EE.

It also renames some spec files (mostly by adding _rake) to match the new pattern.

See https://docs.gitlab.com/ee/ci/testing/fail_fast_testing.html how tff is used.

How to set up and validate locally

# Before on master
tff -f tests.yml $(find {,ee/}lib/tasks -name "*.rake") | wc -l
0

# After
tff -f tests.yml $(find {,ee/}lib/tasks -name "*.rake") | wc -l
65

scripts/verify-tff-mapping
tff mapping verification passed.

Two spec files don't map to any rake task:

$ diff -u mapped.txt all.txt
--- mapped.txt  2023-05-22 11:34:37.368951162 +0200
+++ all.txt     2023-05-22 11:34:49.996649049 +0200
@@ -5,7 +5,9 @@
 ee/spec/tasks/gitlab/geo_rake_spec.rb
 ee/spec/tasks/gitlab/license_rake_spec.rb
 ee/spec/tasks/gitlab/seed/data_seeder_rake_spec.rb
+ee/spec/tasks/gitlab/seed/group_seed_rake_spec.rb
 ee/spec/tasks/gitlab/spdx_rake_spec.rb
+spec/tasks/admin_mode_spec.rb
 spec/tasks/cache_rake_spec.rb
 spec/tasks/config_lint_rake_spec.rb
 spec/tasks/dev_rake_spec.rb
  1. ee/spec/tasks/gitlab/seed/group_seed_rake_spec.rb: It's related to spec/tasks/gitlab/seed/group_seed_rake_spec.rb but takes EE into account. We could integrate this spec into the FOSS version and use Gitlab.ee block 🤷
  2. This is testing that "admin mode" is enabled properly in any rake task. One could argue that we could replace this spec by adding a unit spec for Gitlab::Auth::CurrentUserMode and test admin_mode? differently 🤷

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports