diff options
Diffstat (limited to 'qa/spec/tools')
-rw-r--r-- | qa/spec/tools/ci/non_empty_suites_spec.rb | 4 | ||||
-rw-r--r-- | qa/spec/tools/ci/qa_changes_spec.rb | 52 | ||||
-rw-r--r-- | qa/spec/tools/reliable_report_spec.rb | 3 |
3 files changed, 54 insertions, 5 deletions
diff --git a/qa/spec/tools/ci/non_empty_suites_spec.rb b/qa/spec/tools/ci/non_empty_suites_spec.rb index d9bfe1eebe7..f71e07aa4b4 100644 --- a/qa/spec/tools/ci/non_empty_suites_spec.rb +++ b/qa/spec/tools/ci/non_empty_suites_spec.rb @@ -9,11 +9,11 @@ RSpec.describe QA::Tools::Ci::NonEmptySuites do allow(Gitlab::QA::TestLogger).to receive(:logger).and_return(Logger.new(StringIO.new)) allow(Open3).to receive(:capture3).and_return(["output\n0", "", status]) allow(Open3).to receive(:capture3) - .with("bundle exec bin/qa Test::Instance::All --count-examples-only --address http://dummy1.test") + .with("bundle exec bin/qa QA::Scenario::Test::Instance::All --count-examples-only --address http://dummy1.test") .and_return(["output\n1", "", status]) end it "returns runnable test suites" do - expect(non_empty_suites.fetch).to eq("Test::Instance::All") + expect(non_empty_suites.fetch).to eq("QA::Scenario::Test::Instance::All") end end diff --git a/qa/spec/tools/ci/qa_changes_spec.rb b/qa/spec/tools/ci/qa_changes_spec.rb index bc98ec16d7f..d93d3cd9258 100644 --- a/qa/spec/tools/ci/qa_changes_spec.rb +++ b/qa/spec/tools/ci/qa_changes_spec.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true RSpec.describe QA::Tools::Ci::QaChanges do - subject(:qa_changes) { described_class.new(mr_diff, mr_labels) } + subject(:qa_changes) { described_class.new(mr_diff, mr_labels, additional_group_spec_list) } let(:mr_labels) { [] } + let(:additional_group_spec_list) { [] } before do allow(File).to receive(:directory?).and_return(false) @@ -35,7 +36,7 @@ RSpec.describe QA::Tools::Ci::QaChanges do context "with framework changes" do let(:mr_diff) { [{ path: "qa/qa.rb" }] } - it ".qa_tests do not return specifix specs" do + it ".qa_tests do not return specific specs" do expect(qa_changes.qa_tests).to be_nil end @@ -75,6 +76,43 @@ RSpec.describe QA::Tools::Ci::QaChanges do ) end end + + context "when configured to run tests from other stages" do + let(:additional_group_spec_list) do + { + 'foo' => %w[create], + 'bar' => %w[monitor verify] + } + end + + context "with a single extra stage configured for the group name" do + let(:mr_labels) { %w[devops::manage group::foo] } + + it ".qa_tests return specs for both devops stage and create stage" do + expect(qa_changes.qa_tests.split(" ")).to include( + "qa/specs/features/browser_ui/1_manage/", + "qa/specs/features/api/1_manage/", + "qa/specs/features/browser_ui/3_create/", + "qa/specs/features/api/3_create/" + ) + end + end + + context "with a multiple extra stages configured for the group name" do + let(:mr_labels) { %w[devops::manage group::bar] } + + it ".qa_tests return specs for both devops stage and multiple other stages" do + expect(qa_changes.qa_tests.split(" ")).to include( + "qa/specs/features/browser_ui/1_manage/", + "qa/specs/features/api/1_manage/", + "qa/specs/features/browser_ui/8_monitor/", + "qa/specs/features/api/8_monitor/", + "qa/specs/features/browser_ui/4_verify/", + "qa/specs/features/api/4_verify/" + ) + end + end + end end context "with quarantine changes" do @@ -84,4 +122,14 @@ RSpec.describe QA::Tools::Ci::QaChanges do expect(qa_changes.quarantine_changes?).to eq(true) end end + + %w[GITALY_SERVER_VERSION Gemfile.lock yarn.lock Dockerfile.assets].each do |dependency_file| + context "when #{dependency_file} change" do + let(:mr_diff) { [{ path: dependency_file }] } + + it ".qa_tests do not return specific specs" do + expect(qa_changes.qa_tests).to be_nil + end + end + end end diff --git a/qa/spec/tools/reliable_report_spec.rb b/qa/spec/tools/reliable_report_spec.rb index d5c898779b8..f08af8a717a 100644 --- a/qa/spec/tools/reliable_report_spec.rb +++ b/qa/spec/tools/reliable_report_spec.rb @@ -145,7 +145,8 @@ describe QA::Tools::ReliableReport do let(:common_api_args) do { verify_ssl: false, - headers: { "PRIVATE-TOKEN" => "gitlab_token" } + headers: { "PRIVATE-TOKEN" => "gitlab_token" }, + cookies: {} } end |