Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 15:07:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 15:07:21 +0300
commitef58231bd6702495b8d2d1e7ddc2ad66d1a7dc70 (patch)
tree49d44d81aa99c000e78e692bca18fdcaa134673a /tooling
parent0a921554d8c33ccbbd1f2edcee8cd70a0ecfd1a2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rw-r--r--tooling/lib/tooling/find_codeowners.rb2
-rw-r--r--tooling/lib/tooling/test_map_packer.rb4
-rw-r--r--tooling/quality/test_level.rb23
3 files changed, 10 insertions, 19 deletions
diff --git a/tooling/lib/tooling/find_codeowners.rb b/tooling/lib/tooling/find_codeowners.rb
index 6a90f86eecc..cc37d4db1ec 100644
--- a/tooling/lib/tooling/find_codeowners.rb
+++ b/tooling/lib/tooling/find_codeowners.rb
@@ -89,7 +89,7 @@ module Tooling
end
def consolidate_paths(matched_files)
- matched_files.group_by(&File.method(:dirname)).flat_map do |dir, files|
+ matched_files.group_by { |file| File.dirname(file) }.flat_map do |dir, files|
# First line is the dir itself
if find_dir_maxdepth_1(dir).lines.drop(1).sort == files.sort
"#{dir}\n"
diff --git a/tooling/lib/tooling/test_map_packer.rb b/tooling/lib/tooling/test_map_packer.rb
index 151ce88111f..15191e35c54 100644
--- a/tooling/lib/tooling/test_map_packer.rb
+++ b/tooling/lib/tooling/test_map_packer.rb
@@ -6,11 +6,11 @@ module Tooling
MARKER = 1
def pack(map)
- map.transform_values(&method(:create_tree_from_tests))
+ map.transform_values { |tests| create_tree_from_tests(tests) }
end
def unpack(compact_map)
- compact_map.transform_values(&method(:retrieve_tests_from_tree))
+ compact_map.transform_values { |tree| retrieve_tests_from_tree(tree) }
end
private
diff --git a/tooling/quality/test_level.rb b/tooling/quality/test_level.rb
index 29da7dddd03..eeda135f3ee 100644
--- a/tooling/quality/test_level.rb
+++ b/tooling/quality/test_level.rb
@@ -83,9 +83,12 @@ module Quality
def level_for(file_path)
case file_path
- # Detect migration first since some background migration tests are under
- # spec/lib/gitlab/background_migration and tests under spec/lib are unit by default
- when regexp(:migration), regexp(:background_migration)
+ # Detect background migration first since some are under
+ # spec/lib/gitlab/background_migration
+ # and tests under spec/lib are unit by default
+ when regexp(:background_migration)
+ :background_migration
+ when regexp(:migration)
:migration
# Detect frontend fixture before matching other unit tests
when regexp(:frontend_fixture)
@@ -101,10 +104,6 @@ module Quality
end
end
- def background_migration?(file_path)
- !!(file_path =~ regexp(:background_migration))
- end
-
private
def prefixes_for_pattern
@@ -116,7 +115,7 @@ module Quality
def prefixes_for_regex
return '' if prefixes.empty?
- regex_prefix = prefixes.map(&Regexp.method(:escape)).join('|')
+ regex_prefix = prefixes.map { |prefix| Regexp.escape(prefix) }.join('|')
"(#{regex_prefix})"
end
@@ -130,14 +129,8 @@ module Quality
end
end
- def migration_and_background_migration_folders
- TEST_LEVEL_FOLDERS.fetch(:migration) + TEST_LEVEL_FOLDERS.fetch(:background_migration)
- end
-
def folders_pattern(level)
case level
- when :migration
- "{#{migration_and_background_migration_folders.join(',')}}"
when :all
'**'
else
@@ -147,8 +140,6 @@ module Quality
def folders_regex(level)
case level
- when :migration
- "(#{migration_and_background_migration_folders.join('|')})/"
when :all
''
else