summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/git/repository_spec.rb2
-rw-r--r--qa/spec/resource/events/project_spec.rb6
-rw-r--r--qa/spec/specs/helpers/quarantine_spec.rb6
-rw-r--r--qa/spec/specs/runner_spec.rb46
-rw-r--r--qa/spec/support/matchers/have_assignee.rb15
-rw-r--r--qa/spec/support/matchers/have_child_pipeline.rb15
-rw-r--r--qa/spec/support/matchers/have_content.rb15
-rw-r--r--qa/spec/support/matchers/have_design.rb15
-rw-r--r--qa/spec/support/matchers/have_element.rb15
-rw-r--r--qa/spec/support/matchers/have_file_content.rb15
-rw-r--r--qa/spec/support/matchers/have_issue.rb15
-rw-r--r--qa/spec/support/matchers/have_job.rb15
-rw-r--r--qa/spec/support/matchers/have_package.rb15
-rw-r--r--qa/spec/support/matchers/have_pipeline.rb15
-rw-r--r--qa/spec/support/matchers/have_related_issue_item.rb15
-rw-r--r--qa/spec/support/matchers/have_snippet_description.rb15
-rw-r--r--qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb13
17 files changed, 230 insertions, 23 deletions
diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb
index 02bb7783c28..77639c54b79 100644
--- a/qa/spec/git/repository_spec.rb
+++ b/qa/spec/git/repository_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe QA::Git::Repository do
end
describe '#push_changes' do
- let(:branch) { 'master' }
+ let(:branch) { QA::Runtime::Env.default_branch }
let(:call_method) { repository.push_changes }
let(:command) { "git push #{repo_uri_with_credentials} #{branch}" }
diff --git a/qa/spec/resource/events/project_spec.rb b/qa/spec/resource/events/project_spec.rb
index 88d50749a0a..fa74e2c8477 100644
--- a/qa/spec/resource/events/project_spec.rb
+++ b/qa/spec/resource/events/project_spec.rb
@@ -6,6 +6,10 @@ RSpec.describe QA::Resource::Events::Project do
def api_get_path
'/foo'
end
+
+ def default_branch
+ 'master'
+ end
end
end
@@ -53,7 +57,7 @@ RSpec.describe QA::Resource::Events::Project do
end
describe "#wait_for_push_new_branch" do
- it 'waits for a push to master if no branch is given' do
+ it 'waits for a push to the default branch if no branch is given' do
expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed')
expect { subject.wait_for_push_new_branch }.not_to raise_error
end
diff --git a/qa/spec/specs/helpers/quarantine_spec.rb b/qa/spec/specs/helpers/quarantine_spec.rb
index 41bc3eadff4..80fd65faeed 100644
--- a/qa/spec/specs/helpers/quarantine_spec.rb
+++ b/qa/spec/specs/helpers/quarantine_spec.rb
@@ -423,17 +423,17 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
end
end
- context 'when a pipeline triggered from master runs in gitlab-qa' do
+ context 'when a pipeline triggered from the default branch runs in gitlab-qa' do
before do
stub_env('CI_PROJECT_NAME', 'gitlab-qa')
described_class.configure_rspec
end
- it 'runs on master pipelines' do
+ it 'runs on default branch pipelines' do
group = describe_successfully do
it('runs on master pipeline given a single pipeline', only: { pipeline: :master } ) {}
it('runs in master given an array of pipelines', only: { pipeline: [:canary, :master] }) {}
- it('does not run in non-master pipelines', only: { pipeline: [:nightly, :not_nightly, :not_master] } ) {}
+ it('does not run in non-default pipelines', only: { pipeline: [:nightly, :not_nightly, :not_master] } ) {}
end
aggregate_failures do
diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb
index 8171cfcb3e6..b11054f0bd9 100644
--- a/qa/spec/specs/runner_spec.rb
+++ b/qa/spec/specs/runner_spec.rb
@@ -3,9 +3,9 @@
require 'active_support/core_ext/hash'
RSpec.describe QA::Specs::Runner do
- shared_examples 'excludes orchestrated' do
- it 'excludes the orchestrated tag and includes default args' do
- expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS])
+ shared_examples 'excludes orchestrated and geo' do
+ it 'excludes the orchestrated and geo tags and includes default args' do
+ expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -18,13 +18,13 @@ RSpec.describe QA::Specs::Runner do
QA::Runtime::Scenario.define(:gitlab_address, "http://gitlab.test")
end
- it_behaves_like 'excludes orchestrated'
+ it_behaves_like 'excludes orchestrated and geo'
context 'when tty is set' do
subject { described_class.new.tap { |runner| runner.tty = true } }
it 'sets the `--tty` flag' do
- expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -34,7 +34,7 @@ RSpec.describe QA::Specs::Runner do
subject { described_class.new.tap { |runner| runner.tags = %i[orchestrated github] } }
it 'focuses on the given tags' do
- expect_rspec_runner_arguments(['--tag', 'orchestrated', '--tag', 'github', *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tag', 'orchestrated', '--tag', 'github', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -44,7 +44,7 @@ RSpec.describe QA::Specs::Runner do
subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke] } }
it 'focuses on the given tag without excluded the orchestrated tag' do
- expect_rspec_runner_arguments(['--tag', 'smoke', *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -53,8 +53,8 @@ RSpec.describe QA::Specs::Runner do
context 'when "qa/specs/features/foo" is set as options' do
subject { described_class.new.tap { |runner| runner.options = %w[qa/specs/features/foo] } }
- it 'passes the given tests path and excludes the orchestrated tag' do
- expect_rspec_runner_arguments(['--tag', '~orchestrated', 'qa/specs/features/foo'])
+ it 'passes the given tests path and excludes the orchestrated and geo tags' do
+ expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', 'qa/specs/features/foo'])
subject.perform
end
@@ -64,7 +64,7 @@ RSpec.describe QA::Specs::Runner do
subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke qa/specs/features/foo] } }
it 'focuses on the given tag and includes the path without excluding the orchestrated tag' do
- expect_rspec_runner_arguments(['--tag', 'smoke', 'qa/specs/features/foo'])
+ expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', 'qa/specs/features/foo'])
subject.perform
end
@@ -76,7 +76,7 @@ RSpec.describe QA::Specs::Runner do
end
it 'includes default args and excludes the skip_signup_disabled tag' do
- expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -88,8 +88,24 @@ RSpec.describe QA::Specs::Runner do
end
it 'includes default args and excludes the skip_live_env tag' do
- expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS])
+ subject.perform
+ end
+ end
+
+ context 'when running against a Geo environment' do
+ before do
+ QA::Runtime::Scenario.define(:geo_secondary_address, "https://geo.staging.gitlab.com")
+ end
+
+ after do
+ QA::Runtime::Scenario.attributes.delete(:geo_secondary_address)
+ end
+
+ subject { described_class.new.tap { |runner| runner.tags = %i[geo] } }
+ it 'includes the geo tag' do
+ expect_rspec_runner_arguments(['--tag', 'geo', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
end
@@ -105,7 +121,7 @@ RSpec.describe QA::Specs::Runner do
end
it 'includes default args and excludes all unsupported tags' do
- expect_rspec_runner_arguments(['--tag', '~orchestrated', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS])
+ expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
@@ -130,11 +146,11 @@ RSpec.describe QA::Specs::Runner do
end
end
- it_behaves_like 'excludes orchestrated'
+ it_behaves_like 'excludes orchestrated and geo'
end
context 'when features are not specified' do
- it_behaves_like 'excludes orchestrated'
+ it_behaves_like 'excludes orchestrated and geo'
end
end
diff --git a/qa/spec/support/matchers/have_assignee.rb b/qa/spec/support/matchers/have_assignee.rb
new file mode 100644
index 00000000000..5e7aa2162b2
--- /dev/null
+++ b/qa/spec/support/matchers/have_assignee.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveAssignee
+ RSpec::Matchers.define :have_assignee do |assignee|
+ match do |page_object|
+ page_object.has_assignee?(assignee)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_assignee?(assignee)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_child_pipeline.rb b/qa/spec/support/matchers/have_child_pipeline.rb
new file mode 100644
index 00000000000..d05d9d4209a
--- /dev/null
+++ b/qa/spec/support/matchers/have_child_pipeline.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveChildPipeline
+ RSpec::Matchers.define :have_child_pipeline do
+ match do |page_object|
+ page_object.has_child_pipeline?
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_child_pipeline?
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_content.rb b/qa/spec/support/matchers/have_content.rb
new file mode 100644
index 00000000000..66b30b3b6e4
--- /dev/null
+++ b/qa/spec/support/matchers/have_content.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveContent
+ RSpec::Matchers.define :have_content do |content|
+ match do |page_object|
+ page_object.has_content?(content)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_content?(content)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_design.rb b/qa/spec/support/matchers/have_design.rb
new file mode 100644
index 00000000000..85f1367297a
--- /dev/null
+++ b/qa/spec/support/matchers/have_design.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveDesign
+ RSpec::Matchers.define :have_design do |design|
+ match do |page_object|
+ page_object.has_design?(design)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_design?(design)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_element.rb b/qa/spec/support/matchers/have_element.rb
new file mode 100644
index 00000000000..bf74a78a3b5
--- /dev/null
+++ b/qa/spec/support/matchers/have_element.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveElement
+ RSpec::Matchers.define :have_element do |element, **kwargs|
+ match do |page_object|
+ page_object.has_element?(element, **kwargs)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_element?(element, **kwargs)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_file_content.rb b/qa/spec/support/matchers/have_file_content.rb
new file mode 100644
index 00000000000..e42ece6d59e
--- /dev/null
+++ b/qa/spec/support/matchers/have_file_content.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveFileContent
+ RSpec::Matchers.define :have_file_content do |file_content, file_number|
+ match do |page_object|
+ page_object.has_file_content?(file_content, file_number)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_file_content?(file_content, file_number)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_issue.rb b/qa/spec/support/matchers/have_issue.rb
new file mode 100644
index 00000000000..7ef30f22726
--- /dev/null
+++ b/qa/spec/support/matchers/have_issue.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveIssue
+ RSpec::Matchers.define :have_issue do |issue|
+ match do |page_object|
+ page_object.has_issue?(issue)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_issue?(issue)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_job.rb b/qa/spec/support/matchers/have_job.rb
new file mode 100644
index 00000000000..89829915fce
--- /dev/null
+++ b/qa/spec/support/matchers/have_job.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveJob
+ RSpec::Matchers.define :have_job do |job|
+ match do |page_object|
+ page_object.has_job?(job)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_job?(job)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_package.rb b/qa/spec/support/matchers/have_package.rb
new file mode 100644
index 00000000000..86e9bfee4d1
--- /dev/null
+++ b/qa/spec/support/matchers/have_package.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HavePackage
+ RSpec::Matchers.define :have_package do |package|
+ match do |page_object|
+ page_object.has_package?(package)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_package?(package)
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_pipeline.rb b/qa/spec/support/matchers/have_pipeline.rb
new file mode 100644
index 00000000000..2bfd49d671a
--- /dev/null
+++ b/qa/spec/support/matchers/have_pipeline.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HavePipeline
+ RSpec::Matchers.define :have_pipeline do
+ match do |page_object|
+ page_object.has_pipeline?
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_pipeline?
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_related_issue_item.rb b/qa/spec/support/matchers/have_related_issue_item.rb
new file mode 100644
index 00000000000..89403f2422a
--- /dev/null
+++ b/qa/spec/support/matchers/have_related_issue_item.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveRelatedIssueItem
+ RSpec::Matchers.define :have_related_issue_item do
+ match do |page_object|
+ page_object.has_related_issue_item?
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_related_issue_item?
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/matchers/have_snippet_description.rb b/qa/spec/support/matchers/have_snippet_description.rb
new file mode 100644
index 00000000000..7c407aefc83
--- /dev/null
+++ b/qa/spec/support/matchers/have_snippet_description.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Matchers
+ module HaveSnippetDescription
+ RSpec::Matchers.define :have_snippet_description do |description|
+ match do |page_object|
+ page_object.has_snippet_description?(description)
+ end
+
+ match_when_negated do |page_object|
+ page_object.has_no_snippet_description?
+ end
+ end
+ end
+end
diff --git a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb
index 610bf8b9e28..40a8be8202a 100644
--- a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb
+++ b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb
@@ -30,10 +30,17 @@ module QA
)
end
- # Require approval from code owners on master
- Resource::ProtectedBranch.fabricate! do |protected_branch|
+ # Require approval from code owners on the default branch
+ # The default branch is already protected, and we can't update a protected branch via the API (yet)
+ # so we unprotect it first and then protect it again with the desired parameters
+ Resource::ProtectedBranch.unprotect_via_api! do |protected_branch|
protected_branch.project = project
- protected_branch.branch_name = 'master'
+ protected_branch.branch_name = project.default_branch
+ end
+
+ Resource::ProtectedBranch.fabricate_via_api! do |protected_branch|
+ protected_branch.project = project
+ protected_branch.branch_name = project.default_branch
protected_branch.new_branch = false
protected_branch.require_code_owner_approval = true
end