diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 00:06:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 00:06:14 +0300 |
commit | 170f0bdcdef9c9b226abfe0a50d6687c65e8d613 (patch) | |
tree | 5c82769a5380a0fd495bd1adb098c8c360334587 /qa | |
parent | f1bb2a307e9b125a8ee0be3728cb0d1baa21a3d4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 4 | ||||
-rw-r--r-- | qa/qa/scenario/shared_attributes.rb | 1 | ||||
-rw-r--r-- | qa/qa/specs/loop_runner.rb | 21 | ||||
-rw-r--r-- | qa/qa/specs/runner.rb | 2 |
5 files changed, 29 insertions, 0 deletions
@@ -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' diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index b4047ef5088..bcd2a225469 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -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 diff --git a/qa/qa/scenario/shared_attributes.rb b/qa/qa/scenario/shared_attributes.rb index 52f50ec8c27..bb45c4ce4cb 100644 --- a/qa/qa/scenario/shared_attributes.rb +++ b/qa/qa/scenario/shared_attributes.rb @@ -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 diff --git a/qa/qa/specs/loop_runner.rb b/qa/qa/specs/loop_runner.rb new file mode 100644 index 00000000000..f97f5cbbd81 --- /dev/null +++ b/qa/qa/specs/loop_runner.rb @@ -0,0 +1,21 @@ +# 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 diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 6aa08cf77b4..ac73cc00dbf 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -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? |