Commit ea05925d authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'new-loop-runner' into 'master'

Create loop_runner module to run test repeatedly

See merge request gitlab-org/gitlab!18546
parents a3688fcc 7a3b0090
......@@ -419,6 +419,7 @@ module QA
autoload :Config, 'qa/specs/config'
autoload :Runner, 'qa/specs/runner'
autoload :ParallelRunner, 'qa/specs/parallel_runner'
autoload :LoopRunner, 'qa/specs/loop_runner'
module Helpers
autoload :Quarantine, 'qa/specs/helpers/quarantine'
......
......@@ -261,6 +261,10 @@ module QA
ENV['QA_RUNTIME_SCENARIO_ATTRIBUTES']
end
def gitlab_qa_loop_runner_minutes
ENV.fetch('GITLAB_QA_LOOP_RUNNER_MINUTES', 1).to_i
end
private
def remote_grid_credentials
......
......@@ -8,6 +8,7 @@ module QA
attribute :gitlab_address, '--address URL', 'Address of the instance to test'
attribute :enable_feature, '--enable-feature FEATURE_FLAG', 'Enable a feature before running tests'
attribute :parallel, '--parallel', 'Execute tests in parallel'
attribute :loop, '--loop', 'Execute test repeatedly'
end
end
end
# frozen_string_literal: true
module QA
module Specs
module LoopRunner
module_function
def run(args)
start = Time.now
loop_duration = 60 * QA::Runtime::Env.gitlab_qa_loop_runner_minutes
while Time.now - start < loop_duration
RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero?
end
RSpec.clear_examples
end
end
end
end
end
......@@ -63,6 +63,8 @@ module QA
if Runtime::Scenario.attributes[:parallel]
ParallelRunner.run(args.flatten)
elsif Runtime::Scenario.attributes[:loop]
LoopRunner.run(args.flatten)
else
RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero?
......
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