summaryrefslogtreecommitdiff
path: root/qa/qa/specs/runner.rb
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-06-03 10:37:43 +0000
committerRémy Coutable <remy@rymai.me>2019-06-03 10:37:43 +0000
commit3922c6da841871f010dcffb3fcbfffc48d49bdab (patch)
treeec90ac9c18bbd01056b42dc89bbe5a1de2be0958 /qa/qa/specs/runner.rb
parent0488c26ec6d10b943999b7fb61ca7209ab2c275e (diff)
downloadgitlab-ce-3922c6da841871f010dcffb3fcbfffc48d49bdab.tar.gz
Generate knapsack report for review-qa-all
Add knapsack qa report and use it to run tests in parallel Use the RSpec runner with knapsack The way the Knapsack runner uses exec to start rspec seems incompatible with the way we expect it to work. Plus, it requires specifying KNAPSACK_TEST_DIR. Instead, we use knapsacks AllocatorBuilder to select the spec files to run, and then start rspec as normal, via RSpec::Core::Runner.run This also means we can incorporate tags. Let the job run automatically Include KNAPSACK_TEST_FILE_PATTERN in vars Check all defined knapsack env vars before requiring knapsack
Diffstat (limited to 'qa/qa/specs/runner.rb')
-rw-r--r--qa/qa/specs/runner.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb
index 306913dafa6..f1cb9378de8 100644
--- a/qa/qa/specs/runner.rb
+++ b/qa/qa/specs/runner.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
require 'rspec/core'
+require 'rspec/expectations'
+require 'knapsack'
module QA
module Specs
@@ -32,10 +34,25 @@ module QA
end
args.push(options)
- args.push(DEFAULT_TEST_PATH_ARGS) unless options.any? { |opt| opt =~ %r{/features/} }
Runtime::Browser.configure!
+ if Runtime::Env.knapsack?
+ allocator = Knapsack::AllocatorBuilder.new(Knapsack::Adapters::RSpecAdapter).allocator
+
+ QA::Runtime::Logger.info ''
+ QA::Runtime::Logger.info 'Report specs:'
+ QA::Runtime::Logger.info allocator.report_node_tests.join(', ')
+ QA::Runtime::Logger.info ''
+ QA::Runtime::Logger.info 'Leftover specs:'
+ QA::Runtime::Logger.info allocator.leftover_node_tests.join(', ')
+ QA::Runtime::Logger.info ''
+
+ args.push(['--', allocator.node_tests])
+ else
+ args.push(DEFAULT_TEST_PATH_ARGS) unless options.any? { |opt| opt =~ %r{/features/} }
+ end
+
RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero?
end