summaryrefslogtreecommitdiff
path: root/tooling/bin/find_foss_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tooling/bin/find_foss_tests')
-rwxr-xr-xtooling/bin/find_foss_tests12
1 files changed, 4 insertions, 8 deletions
diff --git a/tooling/bin/find_foss_tests b/tooling/bin/find_foss_tests
index c694210ad40..9cd8a616ad0 100755
--- a/tooling/bin/find_foss_tests
+++ b/tooling/bin/find_foss_tests
@@ -1,10 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-require_relative '../../lib/gitlab/popen'
-require_relative '../lib/tooling/test_file_finder'
-
require 'gitlab'
+require 'test_file_finder'
gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '')
@@ -21,9 +19,7 @@ mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID')
mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid)
changed_files = mr_changes.changes.map { |change| change['new_path'] }
-tests_to_run = changed_files.flat_map do |file|
- test_files = Tooling::TestFileFinder.new(file, foss_test_only: true).test_files
- test_files.select { |f| File.exist?(f) }
-end
+mapping = TestFileFinder::Mapping.load('tests.yml')
+test_files = TestFileFinder::FileFinder.new(paths: changed_files, mapping: mapping).test_files
-File.write(output_file, tests_to_run.uniq.join(' '))
+File.write(output_file, test_files.uniq.join(' '))