Commit 71fb321c authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '288334-avoid-calculating-testing-files-twice-in-parallel_rspec_runner' into 'master'

Resolve "Avoid calculating testing files twice in parallel_rspec_runner"

See merge request gitlab-org/gitlab!48643
parents 721f251f 40c5d8ee
......@@ -157,6 +157,7 @@
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
.code-patterns: &code-patterns
- "{package.json,yarn.lock}"
......@@ -203,6 +204,7 @@
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
.code-qa-patterns: &code-qa-patterns
- "{package.json,yarn.lock}"
......@@ -248,6 +250,7 @@
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
# QA changes
- ".dockerignore"
- "qa/**/*"
......
......@@ -11,6 +11,9 @@ require 'knapsack'
#
# Only the test files allocated by Knapsack and listed in the file
# would be executed in the CI node.
#
# Reference:
# https://github.com/ArturT/knapsack/blob/v1.20.0/lib/knapsack/runners/rspec_runner.rb
module Tooling
class ParallelRSpecRunner
def self.run(rspec_args: nil, filter_tests_file: nil)
......@@ -54,7 +57,7 @@ module Tooling
def tests_to_run
return node_tests if filter_tests.empty?
node_tests & filter_tests
@tests_to_run ||= node_tests & filter_tests
end
def node_tests
......@@ -62,7 +65,8 @@ module Tooling
end
def filter_tests
filter_tests_file ? tests_from_file(filter_tests_file) : []
@filter_tests ||=
filter_tests_file ? tests_from_file(filter_tests_file) : []
end
def tests_from_file(filter_tests_file)
......
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