diff options
Diffstat (limited to 'qa/tasks/ci.rake')
-rw-r--r-- | qa/tasks/ci.rake | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/qa/tasks/ci.rake b/qa/tasks/ci.rake index 435fe8ebb77..84a26e3e555 100644 --- a/qa/tasks/ci.rake +++ b/qa/tasks/ci.rake @@ -1,9 +1,8 @@ # frozen_string_literal: true -require_relative "helpers/util" - -# rubocop:disable Rails/RakeEnvironment namespace :ci do + require_relative "helpers/util" + include Task::Helpers::Util desc "Detect changes and populate test variables for selective test execution and feature flag testing" @@ -23,18 +22,20 @@ namespace :ci do # skip running tests when only quarantine changes detected if qa_changes.quarantine_changes? logger.info(" merge request contains only quarantine changes, e2e test execution will be skipped!") - append_to_file(env_file, <<~TXT) - QA_SKIP_ALL_TESTS=true - TXT + append_to_file(env_file, "QA_SKIP_ALL_TESTS=true") next end - tests = qa_changes.qa_tests - if qa_changes.framework_changes? # run all tests when framework changes detected + run_all_label_present = mr_labels.include?("pipeline:run-all-e2e") + # on run-all label of framework changes do not infer specific tests + tests = run_all_label_present || qa_changes.framework_changes? ? nil : qa_changes.qa_tests + + if run_all_label_present + logger.info(" merge request has pipeline:run-all-e2e label, full test suite will be executed") + append_to_file(env_file, "QA_RUN_ALL_TESTS=true\n") + elsif qa_changes.framework_changes? # run all tests when framework changes detected logger.info(" merge request contains qa framework changes, full test suite will be executed") - append_to_file(env_file, <<~TXT) - QA_FRAMEWORK_CHANGES=true - TXT + append_to_file(env_file, "QA_FRAMEWORK_CHANGES=true\n") elsif tests logger.info(" detected following specs to execute: '#{tests}'") else @@ -44,20 +45,24 @@ namespace :ci do # always check all test suites in case a suite is defined but doesn't have any runnable specs suites = QA::Tools::Ci::NonEmptySuites.new(tests).fetch append_to_file(env_file, <<~TXT) - QA_TESTS='#{tests}' QA_SUITES='#{suites}' + QA_TESTS='#{tests}' TXT # check if mr contains feature flag changes feature_flags = QA::Tools::Ci::FfChanges.new(diff).fetch - append_to_file(env_file, <<~TXT) - QA_FEATURE_FLAGS='#{feature_flags}' - TXT + append_to_file(env_file, "QA_FEATURE_FLAGS='#{feature_flags}'") end desc "Download test results from downstream pipeline" task :download_test_results, [:trigger_name, :test_report_job_name, :report_path] do |_, args| QA::Tools::Ci::TestResults.get(args[:trigger_name], args[:test_report_job_name], args[:report_path]) end + + desc "Export test run metrics to influxdb" + task :export_test_metrics, [:glob] do |_, args| + raise("Metrics file glob pattern is required") unless args[:glob] + + QA::Tools::Ci::TestMetrics.export(args[:glob]) + end end -# rubocop:enable Rails/RakeEnvironment |