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 @@ ...@@ -157,6 +157,7 @@
- "{,ee/}fixtures/**/*" - "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*" - "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*" - "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
.code-patterns: &code-patterns .code-patterns: &code-patterns
- "{package.json,yarn.lock}" - "{package.json,yarn.lock}"
...@@ -203,6 +204,7 @@ ...@@ -203,6 +204,7 @@
- "{,ee/}fixtures/**/*" - "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*" - "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*" - "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
.code-qa-patterns: &code-qa-patterns .code-qa-patterns: &code-qa-patterns
- "{package.json,yarn.lock}" - "{package.json,yarn.lock}"
...@@ -248,6 +250,7 @@ ...@@ -248,6 +250,7 @@
- "{,ee/}fixtures/**/*" - "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*" - "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*" - "{,ee/}spec/**/*"
- "{,spec/}tooling/**/*"
# QA changes # QA changes
- ".dockerignore" - ".dockerignore"
- "qa/**/*" - "qa/**/*"
......
...@@ -11,6 +11,9 @@ require 'knapsack' ...@@ -11,6 +11,9 @@ require 'knapsack'
# #
# Only the test files allocated by Knapsack and listed in the file # Only the test files allocated by Knapsack and listed in the file
# would be executed in the CI node. # 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 module Tooling
class ParallelRSpecRunner class ParallelRSpecRunner
def self.run(rspec_args: nil, filter_tests_file: nil) def self.run(rspec_args: nil, filter_tests_file: nil)
...@@ -54,7 +57,7 @@ module Tooling ...@@ -54,7 +57,7 @@ module Tooling
def tests_to_run def tests_to_run
return node_tests if filter_tests.empty? return node_tests if filter_tests.empty?
node_tests & filter_tests @tests_to_run ||= node_tests & filter_tests
end end
def node_tests def node_tests
...@@ -62,6 +65,7 @@ module Tooling ...@@ -62,6 +65,7 @@ module Tooling
end end
def filter_tests def filter_tests
@filter_tests ||=
filter_tests_file ? tests_from_file(filter_tests_file) : [] filter_tests_file ? tests_from_file(filter_tests_file) : []
end end
......
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