Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/factory/resource/user_spec.rb2
-rw-r--r--qa/spec/fixtures/tanuki.jpgbin0 -> 84616 bytes
-rw-r--r--qa/spec/fixtures/values.pngbin0 -> 122101 bytes
-rw-r--r--qa/spec/git/location_spec.rb2
-rw-r--r--qa/spec/git/repository_spec.rb62
-rw-r--r--qa/spec/page/base_spec.rb2
-rw-r--r--qa/spec/page/element_spec.rb2
-rw-r--r--qa/spec/page/logging_spec.rb2
-rw-r--r--qa/spec/page/validator_spec.rb2
-rw-r--r--qa/spec/page/view_spec.rb2
-rw-r--r--qa/spec/resource/api_fabricator_spec.rb2
-rw-r--r--qa/spec/resource/base_spec.rb2
-rw-r--r--qa/spec/resource/events/base_spec.rb2
-rw-r--r--qa/spec/resource/events/project_spec.rb2
-rw-r--r--qa/spec/resource/repository/push_spec.rb2
-rw-r--r--qa/spec/resource/ssh_key_spec.rb2
-rw-r--r--qa/spec/resource/user_spec.rb2
-rw-r--r--qa/spec/runtime/api/client_spec.rb2
-rw-r--r--qa/spec/runtime/api/request_spec.rb2
-rw-r--r--qa/spec/runtime/application_settings_spec.rb2
-rw-r--r--qa/spec/runtime/env_spec.rb2
-rw-r--r--qa/spec/runtime/feature_spec.rb252
-rw-r--r--qa/spec/runtime/key/ecdsa_spec.rb2
-rw-r--r--qa/spec/runtime/key/ed25519_spec.rb2
-rw-r--r--qa/spec/runtime/key/rsa_spec.rb2
-rw-r--r--qa/spec/runtime/logger_spec.rb2
-rw-r--r--qa/spec/runtime/namespace_spec.rb2
-rw-r--r--qa/spec/runtime/release_spec.rb2
-rw-r--r--qa/spec/runtime/scenario_spec.rb2
-rw-r--r--qa/spec/scenario/actable_spec.rb2
-rw-r--r--qa/spec/scenario/bootable_spec.rb2
-rw-r--r--qa/spec/scenario/template_spec.rb2
-rw-r--r--qa/spec/scenario/test/instance/airgapped_spec.rb2
-rw-r--r--qa/spec/scenario/test/instance/all_spec.rb2
-rw-r--r--qa/spec/scenario/test/instance/smoke_spec.rb2
-rw-r--r--qa/spec/scenario/test/integration/github_spec.rb2
-rw-r--r--qa/spec/scenario/test/integration/instance_saml_spec.rb2
-rw-r--r--qa/spec/scenario/test/integration/kubernetes_spec.rb2
-rw-r--r--qa/spec/scenario/test/integration/ldap_spec.rb6
-rw-r--r--qa/spec/scenario/test/integration/mattermost_spec.rb2
-rw-r--r--qa/spec/scenario/test/integration/object_storage_spec.rb2
-rw-r--r--qa/spec/scenario/test/sanity/framework_spec.rb2
-rw-r--r--qa/spec/scenario/test/sanity/selectors_spec.rb2
-rw-r--r--qa/spec/specs/helpers/quarantine_spec.rb2
-rw-r--r--qa/spec/specs/parallel_runner_spec.rb2
-rw-r--r--qa/spec/specs/runner_spec.rb2
-rw-r--r--qa/spec/support/repeater_spec.rb2
-rw-r--r--qa/spec/support/retrier_spec.rb2
-rw-r--r--qa/spec/support/wait_for_requests_spec.rb3
-rw-r--r--qa/spec/support/waiter_spec.rb2
50 files changed, 299 insertions, 112 deletions
diff --git a/qa/spec/factory/resource/user_spec.rb b/qa/spec/factory/resource/user_spec.rb
index d59ee24c758..1adf3799b0e 100644
--- a/qa/spec/factory/resource/user_spec.rb
+++ b/qa/spec/factory/resource/user_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::User do
+RSpec.describe QA::Resource::User do
describe "#fabricate_via_api!" do
response = Struct.new(:code, :body)
diff --git a/qa/spec/fixtures/tanuki.jpg b/qa/spec/fixtures/tanuki.jpg
new file mode 100644
index 00000000000..f0df472663e
--- /dev/null
+++ b/qa/spec/fixtures/tanuki.jpg
Binary files differ
diff --git a/qa/spec/fixtures/values.png b/qa/spec/fixtures/values.png
new file mode 100644
index 00000000000..9ecb6e7b778
--- /dev/null
+++ b/qa/spec/fixtures/values.png
Binary files differ
diff --git a/qa/spec/git/location_spec.rb b/qa/spec/git/location_spec.rb
index 0c57291666f..ee714206e4f 100644
--- a/qa/spec/git/location_spec.rb
+++ b/qa/spec/git/location_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Git::Location do
+RSpec.describe QA::Git::Location do
describe '.new' do
context 'when URI starts with ssh://' do
context 'when URI has port' do
diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb
index 8355c77f493..2ac7a99d82f 100644
--- a/qa/spec/git/repository_spec.rb
+++ b/qa/spec/git/repository_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Git::Repository do
+RSpec.describe QA::Git::Repository do
include Helpers::StubENV
shared_context 'unresolvable git directory' do
@@ -117,6 +117,66 @@ describe QA::Git::Repository do
let(:call_method) { repository.push_changes(branch) }
end
end
+
+ context 'with push options' do
+ let(:command) { "git push #{push_options} #{repo_uri_with_credentials} #{branch}" }
+
+ context 'when set to create a merge request' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.create' }
+ let(:call_method) { repository.push_changes(push_options: { create: true }) }
+ end
+ end
+
+ context 'when set to merge when pipeline succeeds' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.merge_when_pipeline_succeeds' }
+ let(:call_method) { repository.push_changes(push_options: { merge_when_pipeline_succeeds: true }) }
+ end
+ end
+
+ context 'when set to remove source branch' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.remove_source_branch' }
+ let(:call_method) { repository.push_changes(push_options: { remove_source_branch: true }) }
+ end
+ end
+
+ context 'when title is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.title="Is A Title"' }
+ let(:call_method) { repository.push_changes(push_options: { title: 'Is A Title' }) }
+ end
+ end
+
+ context 'when description is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.description="Is A Description"' }
+ let(:call_method) { repository.push_changes(push_options: { description: 'Is A Description' }) }
+ end
+ end
+
+ context 'when target branch is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.target="is-a-target-branch"' }
+ let(:call_method) { repository.push_changes(push_options: { target: 'is-a-target-branch' }) }
+ end
+ end
+
+ context 'when a label is given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.label="is-a-label"' }
+ let(:call_method) { repository.push_changes(push_options: { label: ['is-a-label'] }) }
+ end
+ end
+
+ context 'when two labels are given' do
+ it_behaves_like 'command with retries' do
+ let(:push_options) { '-o merge_request.label="is-a-label" -o merge_request.label="is-another-label"' }
+ let(:call_method) { repository.push_changes(push_options: { label: %w[is-a-label is-another-label] }) }
+ end
+ end
+ end
end
describe '#git_protocol=' do
diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb
index 0cbb0a2b12e..52345876149 100644
--- a/qa/spec/page/base_spec.rb
+++ b/qa/spec/page/base_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Page::Base do
+RSpec.describe QA::Page::Base do
describe 'page helpers' do
it 'exposes helpful page helpers' do
expect(subject).to respond_to :refresh, :wait_until, :scroll_to
diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb
index 3f64743ffac..fbf58b5e18a 100644
--- a/qa/spec/page/element_spec.rb
+++ b/qa/spec/page/element_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Page::Element do
+RSpec.describe QA::Page::Element do
describe '#selector' do
it 'transforms element name into QA-specific selector' do
expect(described_class.new(:sign_in_button).selector)
diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb
index f2ce9fb2cf8..df3447770be 100644
--- a/qa/spec/page/logging_spec.rb
+++ b/qa/spec/page/logging_spec.rb
@@ -3,7 +3,7 @@
require 'capybara/dsl'
require 'logger'
-describe QA::Support::Page::Logging do
+RSpec.describe QA::Support::Page::Logging do
let(:page) { double.as_null_object }
before do
diff --git a/qa/spec/page/validator_spec.rb b/qa/spec/page/validator_spec.rb
index c727cfb686e..cfb36052294 100644
--- a/qa/spec/page/validator_spec.rb
+++ b/qa/spec/page/validator_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Page::Validator do
+RSpec.describe QA::Page::Validator do
describe '#constants' do
subject do
described_class.new(QA::Page::Project)
diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb
index 3cb64dcd9c2..3342b387ed1 100644
--- a/qa/spec/page/view_spec.rb
+++ b/qa/spec/page/view_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Page::View do
+RSpec.describe QA::Page::View do
let(:element) do
double('element', name: :something, pattern: /some element/)
end
diff --git a/qa/spec/resource/api_fabricator_spec.rb b/qa/spec/resource/api_fabricator_spec.rb
index eb2bdd1be64..69a95c92332 100644
--- a/qa/spec/resource/api_fabricator_spec.rb
+++ b/qa/spec/resource/api_fabricator_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::ApiFabricator do
+RSpec.describe QA::Resource::ApiFabricator do
let(:resource_without_api_support) do
Class.new do
def self.name
diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb
index b23de19e1f8..c0bedf794be 100644
--- a/qa/spec/resource/base_spec.rb
+++ b/qa/spec/resource/base_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::Base do
+RSpec.describe QA::Resource::Base do
include Helpers::StubENV
let(:resource) { spy('resource') }
diff --git a/qa/spec/resource/events/base_spec.rb b/qa/spec/resource/events/base_spec.rb
index 9cdf4785092..4df30a970fc 100644
--- a/qa/spec/resource/events/base_spec.rb
+++ b/qa/spec/resource/events/base_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::Events::Base do
+RSpec.describe QA::Resource::Events::Base do
let(:resource) do
Class.new(QA::Resource::Base) do
def api_get_path
diff --git a/qa/spec/resource/events/project_spec.rb b/qa/spec/resource/events/project_spec.rb
index 98da87906fa..88d50749a0a 100644
--- a/qa/spec/resource/events/project_spec.rb
+++ b/qa/spec/resource/events/project_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::Events::Project do
+RSpec.describe QA::Resource::Events::Project do
let(:resource) do
Class.new(QA::Resource::Base) do
def api_get_path
diff --git a/qa/spec/resource/repository/push_spec.rb b/qa/spec/resource/repository/push_spec.rb
index 2f9e4958ae1..2b9c90b3dac 100644
--- a/qa/spec/resource/repository/push_spec.rb
+++ b/qa/spec/resource/repository/push_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::Repository::Push do
+RSpec.describe QA::Resource::Repository::Push do
describe '.files=' do
let(:files) do
[
diff --git a/qa/spec/resource/ssh_key_spec.rb b/qa/spec/resource/ssh_key_spec.rb
index b2b5ec070e1..fd0fda3c1b8 100644
--- a/qa/spec/resource/ssh_key_spec.rb
+++ b/qa/spec/resource/ssh_key_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::SSHKey do
+RSpec.describe QA::Resource::SSHKey do
describe '#key' do
it 'generates a default key' do
expect(subject.key).to be_a(QA::Runtime::Key::RSA)
diff --git a/qa/spec/resource/user_spec.rb b/qa/spec/resource/user_spec.rb
index 5845f7996a3..e7397d9c0bf 100644
--- a/qa/spec/resource/user_spec.rb
+++ b/qa/spec/resource/user_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Resource::User do
+RSpec.describe QA::Resource::User do
let(:api_resource) do
{
name: "GitLab QA",
diff --git a/qa/spec/runtime/api/client_spec.rb b/qa/spec/runtime/api/client_spec.rb
index 6f7020d6595..dd139fda980 100644
--- a/qa/spec/runtime/api/client_spec.rb
+++ b/qa/spec/runtime/api/client_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::API::Client do
+RSpec.describe QA::Runtime::API::Client do
include Helpers::StubENV
describe 'initialization' do
diff --git a/qa/spec/runtime/api/request_spec.rb b/qa/spec/runtime/api/request_spec.rb
index 8354eff6234..93de2f4a87e 100644
--- a/qa/spec/runtime/api/request_spec.rb
+++ b/qa/spec/runtime/api/request_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::API::Request do
+RSpec.describe QA::Runtime::API::Request do
let(:client) { QA::Runtime::API::Client.new('http://example.com') }
let(:request) { described_class.new(client, '/users') }
diff --git a/qa/spec/runtime/application_settings_spec.rb b/qa/spec/runtime/application_settings_spec.rb
index e48214b22e6..5c4947f6f70 100644
--- a/qa/spec/runtime/application_settings_spec.rb
+++ b/qa/spec/runtime/application_settings_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::ApplicationSettings do
+RSpec.describe QA::Runtime::ApplicationSettings do
let(:api_client) { double('QA::Runtime::API::Client') }
let(:request) { Struct.new(:url).new('http://api') }
let(:get_response) { Struct.new(:body).new("{}") }
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index 0cfb9a70c88..bf6c01bf251 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Env do
+RSpec.describe QA::Runtime::Env do
include Helpers::StubENV
shared_examples 'boolean method' do |**kwargs|
diff --git a/qa/spec/runtime/feature_spec.rb b/qa/spec/runtime/feature_spec.rb
index db3c2f65963..39c20dd3070 100644
--- a/qa/spec/runtime/feature_spec.rb
+++ b/qa/spec/runtime/feature_spec.rb
@@ -1,87 +1,215 @@
# frozen_string_literal: true
-describe QA::Runtime::Feature do
+RSpec.describe QA::Runtime::Feature do
let(:api_client) { double('QA::Runtime::API::Client') }
let(:request) { Struct.new(:url).new('http://api') }
let(:response_post) { Struct.new(:code).new(201) }
- let(:response_get) { Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "on" }]') }
before do
allow(described_class).to receive(:api_client).and_return(api_client)
end
- describe '.enable' do
- it 'enables a feature flag' do
- expect(QA::Runtime::API::Request)
- .to receive(:new)
- .with(api_client, "/features/a-flag")
- .and_return(request)
- expect(described_class)
- .to receive(:post)
- .with(request.url, { value: true })
- .and_return(response_post)
-
- subject.enable('a-flag')
- end
+ where(:feature_flag) do
+ ['a_flag', :a_flag]
end
- describe '.enable_and_verify' do
- it 'enables a feature flag' do
- allow(described_class).to receive(:get).and_return(response_get)
+ with_them do
+ shared_examples 'enables a feature flag' do
+ it 'enables a feature flag for a scope' do
+ allow(described_class).to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]'))
- expect(QA::Runtime::API::Request).to receive(:new)
- .with(api_client, "/features/a-flag").and_return(request)
- expect(described_class).to receive(:post)
- .with(request.url, { value: true }).and_return(response_post)
- expect(QA::Runtime::API::Request).to receive(:new)
- .with(api_client, "/features").and_return(request)
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features/a_flag").and_return(request)
+ expect(described_class).to receive(:post)
+ .with(request.url, { value: true, scope => actor_name }).and_return(response_post)
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features").and_return(request)
+ expect(QA::Runtime::Logger).to receive(:info).with("Enabling feature: a_flag for scope \"#{scope}: #{actor_name}\"")
+ expect(QA::Runtime::Logger).to receive(:info).with("Successfully enabled and verified feature flag: a_flag")
- subject.enable_and_verify('a-flag')
+ described_class.enable(feature_flag, scope => actor)
+ end
end
- end
- describe '.disable' do
- it 'disables a feature flag' do
- expect(QA::Runtime::API::Request)
- .to receive(:new)
- .with(api_client, "/features/a-flag")
- .and_return(request)
- expect(described_class)
- .to receive(:post)
- .with(request.url, { value: false })
- .and_return(response_post)
-
- subject.disable('a-flag')
+ shared_examples 'disables a feature flag' do
+ it 'disables a feature flag for a scope' do
+ allow(described_class).to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "off" }]'))
+
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features/a_flag").and_return(request)
+ expect(described_class).to receive(:post)
+ .with(request.url, { value: false, scope => actor_name }).and_return(response_post)
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features").and_return(request)
+ expect(QA::Runtime::Logger).to receive(:info).with("Disabling feature: a_flag for scope \"#{scope}: #{actor_name}\"")
+ expect(QA::Runtime::Logger).to receive(:info).with("Successfully disabled and verified feature flag: a_flag")
+
+ described_class.disable(feature_flag, scope => actor )
+ end
end
- end
- describe '.disable_and_verify' do
- it 'disables a feature flag' do
- allow(described_class).to receive(:get)
- .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "off" }]'))
+ shared_examples 'checks a feature flag' do
+ context 'when the flag is enabled for a scope' do
+ it 'returns the feature flag state' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, "/features")
+ .and_return(request)
+ expect(described_class)
+ .to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, %Q([{ "name": "a_flag", "state": "conditional", "gates": #{gates} }])))
+
+ expect(described_class.enabled?(feature_flag, scope => actor)).to be_truthy
+ end
+ end
+ end
- expect(QA::Runtime::API::Request).to receive(:new)
- .with(api_client, "/features/a-flag").and_return(request)
- expect(described_class).to receive(:post)
- .with(request.url, { value: false }).and_return(response_post)
- expect(QA::Runtime::API::Request).to receive(:new)
- .with(api_client, "/features").and_return(request)
+ describe '.enable' do
+ it 'enables a feature flag' do
+ allow(described_class).to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]'))
- subject.disable_and_verify('a-flag')
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features/a_flag").and_return(request)
+ expect(described_class).to receive(:post)
+ .with(request.url, { value: true }).and_return(response_post)
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features").and_return(request)
+
+ described_class.enable(feature_flag)
+ end
+
+ context 'when a project scope is provided' do
+ it_behaves_like 'enables a feature flag' do
+ let(:scope) { :project }
+ let(:actor_name) { 'group-name/project-name' }
+ let(:actor) { Struct.new(:full_path).new(actor_name) }
+ end
+ end
+
+ context 'when a group scope is provided' do
+ it_behaves_like 'enables a feature flag' do
+ let(:scope) { :group }
+ let(:actor_name) { 'group-name' }
+ let(:actor) { Struct.new(:full_path).new(actor_name) }
+ end
+ end
+
+ context 'when a user scope is provided' do
+ it_behaves_like 'enables a feature flag' do
+ let(:scope) { :user }
+ let(:actor_name) { 'user-name' }
+ let(:actor) { Struct.new(:username).new(actor_name) }
+ end
+ end
+
+ context 'when a feature group scope is provided' do
+ it_behaves_like 'enables a feature flag' do
+ let(:scope) { :feature_group }
+ let(:actor_name) { 'foo' }
+ let(:actor) { "foo" }
+ end
+ end
end
- end
- describe '.enabled?' do
- it 'returns a feature flag state' do
- expect(QA::Runtime::API::Request)
- .to receive(:new)
- .with(api_client, "/features")
- .and_return(request)
- expect(described_class)
- .to receive(:get)
- .and_return(response_get)
-
- expect(subject.enabled?('a-flag')).to be_truthy
+ describe '.disable' do
+ it 'disables a feature flag' do
+ allow(described_class).to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "off" }]'))
+
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features/a_flag").and_return(request)
+ expect(described_class).to receive(:post)
+ .with(request.url, { value: false }).and_return(response_post)
+ expect(QA::Runtime::API::Request).to receive(:new)
+ .with(api_client, "/features").and_return(request)
+
+ described_class.disable(feature_flag)
+ end
+
+ context 'when a project scope is provided' do
+ it_behaves_like 'disables a feature flag' do
+ let(:scope) { :project }
+ let(:actor_name) { 'group-name/project-name' }
+ let(:actor) { Struct.new(:full_path).new(actor_name) }
+ end
+ end
+
+ context 'when a group scope is provided' do
+ it_behaves_like 'disables a feature flag' do
+ let(:scope) { :group }
+ let(:actor_name) { 'group-name' }
+ let(:actor) { Struct.new(:full_path).new(actor_name) }
+ end
+ end
+
+ context 'when a user scope is provided' do
+ it_behaves_like 'disables a feature flag' do
+ let(:scope) { :user }
+ let(:actor_name) { 'user-name' }
+ let(:actor) { Struct.new(:username).new(actor_name) }
+ end
+ end
+
+ context 'when a feature group scope is provided' do
+ it_behaves_like 'disables a feature flag' do
+ let(:scope) { :feature_group }
+ let(:actor_name) { 'foo' }
+ let(:actor) { "foo" }
+ end
+ end
+ end
+
+ describe '.enabled?' do
+ it 'returns a feature flag state' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, "/features")
+ .and_return(request)
+ expect(described_class)
+ .to receive(:get)
+ .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]'))
+
+ expect(described_class.enabled?(feature_flag)).to be_truthy
+ end
+
+ context 'when a project scope is provided' do
+ it_behaves_like 'checks a feature flag' do
+ let(:scope) { :project }
+ let(:actor_name) { 'group-name/project-name' }
+ let(:actor) { Struct.new(:full_path, :id).new(actor_name, 270) }
+ let(:gates) { %q([{"key": "actors", "value": ["Project:270"]}]) }
+ end
+ end
+
+ context 'when a group scope is provided' do
+ it_behaves_like 'checks a feature flag' do
+ let(:scope) { :group }
+ let(:actor_name) { 'group-name' }
+ let(:actor) { Struct.new(:full_path, :id).new(actor_name, 33) }
+ let(:gates) { %q([{"key": "actors", "value": ["Group:33"]}]) }
+ end
+ end
+
+ context 'when a user scope is provided' do
+ it_behaves_like 'checks a feature flag' do
+ let(:scope) { :user }
+ let(:actor_name) { 'user-name' }
+ let(:actor) { Struct.new(:full_path, :id).new(actor_name, 13) }
+ let(:gates) { %q([{"key": "actors", "value": ["User:13"]}]) }
+ end
+ end
+
+ context 'when a feature group scope is provided' do
+ it_behaves_like 'checks a feature flag' do
+ let(:scope) { :feature_group }
+ let(:actor_name) { 'foo' }
+ let(:actor) { "foo" }
+ let(:gates) { %q([{"key": "groups", "value": ["foo"]}]) }
+ end
+ end
end
end
end
diff --git a/qa/spec/runtime/key/ecdsa_spec.rb b/qa/spec/runtime/key/ecdsa_spec.rb
index 3f9718e62c5..499233df618 100644
--- a/qa/spec/runtime/key/ecdsa_spec.rb
+++ b/qa/spec/runtime/key/ecdsa_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Key::ECDSA do
+RSpec.describe QA::Runtime::Key::ECDSA do
describe '#public_key' do
[256, 384, 521].each do |bits|
it "generates a public #{bits}-bits ECDSA key" do
diff --git a/qa/spec/runtime/key/ed25519_spec.rb b/qa/spec/runtime/key/ed25519_spec.rb
index 08f232260af..e63c7f5deae 100644
--- a/qa/spec/runtime/key/ed25519_spec.rb
+++ b/qa/spec/runtime/key/ed25519_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Key::ED25519 do
+RSpec.describe QA::Runtime::Key::ED25519 do
describe '#public_key' do
subject { described_class.new.public_key }
diff --git a/qa/spec/runtime/key/rsa_spec.rb b/qa/spec/runtime/key/rsa_spec.rb
index fcb52f541bf..5b5d8a13fa1 100644
--- a/qa/spec/runtime/key/rsa_spec.rb
+++ b/qa/spec/runtime/key/rsa_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Key::RSA do
+RSpec.describe QA::Runtime::Key::RSA do
describe '#public_key' do
subject { described_class.new.public_key }
diff --git a/qa/spec/runtime/logger_spec.rb b/qa/spec/runtime/logger_spec.rb
index 44be3381bff..a888bf1452b 100644
--- a/qa/spec/runtime/logger_spec.rb
+++ b/qa/spec/runtime/logger_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Logger do
+RSpec.describe QA::Runtime::Logger do
before do
logger = Logger.new $stdout
logger.level = ::Logger::DEBUG
diff --git a/qa/spec/runtime/namespace_spec.rb b/qa/spec/runtime/namespace_spec.rb
index d24fa509f30..92836862864 100644
--- a/qa/spec/runtime/namespace_spec.rb
+++ b/qa/spec/runtime/namespace_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Namespace do
+RSpec.describe QA::Runtime::Namespace do
include Helpers::StubENV
describe '.name' do
diff --git a/qa/spec/runtime/release_spec.rb b/qa/spec/runtime/release_spec.rb
index b5a7dd5269d..b4e278fb546 100644
--- a/qa/spec/runtime/release_spec.rb
+++ b/qa/spec/runtime/release_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Release do
+RSpec.describe QA::Runtime::Release do
context 'when release version has extension strategy' do
let(:strategy) { spy('strategy') }
diff --git a/qa/spec/runtime/scenario_spec.rb b/qa/spec/runtime/scenario_spec.rb
index 30ada4529ed..175973b6795 100644
--- a/qa/spec/runtime/scenario_spec.rb
+++ b/qa/spec/runtime/scenario_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Runtime::Scenario do
+RSpec.describe QA::Runtime::Scenario do
subject do
Module.new.extend(described_class)
end
diff --git a/qa/spec/scenario/actable_spec.rb b/qa/spec/scenario/actable_spec.rb
index 589d0c61993..36e9f3de961 100644
--- a/qa/spec/scenario/actable_spec.rb
+++ b/qa/spec/scenario/actable_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Actable do
+RSpec.describe QA::Scenario::Actable do
subject do
Class.new do
include QA::Scenario::Actable
diff --git a/qa/spec/scenario/bootable_spec.rb b/qa/spec/scenario/bootable_spec.rb
index e8accb45518..8a96e9bebbf 100644
--- a/qa/spec/scenario/bootable_spec.rb
+++ b/qa/spec/scenario/bootable_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Bootable do
+RSpec.describe QA::Scenario::Bootable do
subject do
Class.new(QA::Scenario::Template)
.include(described_class)
diff --git a/qa/spec/scenario/template_spec.rb b/qa/spec/scenario/template_spec.rb
index 65793734548..f07d817ea16 100644
--- a/qa/spec/scenario/template_spec.rb
+++ b/qa/spec/scenario/template_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Template do
+RSpec.describe QA::Scenario::Template do
let(:feature) { spy('Runtime::Feature') }
let(:release) { spy('Runtime::Release') }
diff --git a/qa/spec/scenario/test/instance/airgapped_spec.rb b/qa/spec/scenario/test/instance/airgapped_spec.rb
index 0c4167eafff..5e319ba4bbb 100644
--- a/qa/spec/scenario/test/instance/airgapped_spec.rb
+++ b/qa/spec/scenario/test/instance/airgapped_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Instance::Airgapped do
+RSpec.describe QA::Scenario::Test::Instance::Airgapped do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
end
diff --git a/qa/spec/scenario/test/instance/all_spec.rb b/qa/spec/scenario/test/instance/all_spec.rb
index 8acd56914c5..875df9a32f5 100644
--- a/qa/spec/scenario/test/instance/all_spec.rb
+++ b/qa/spec/scenario/test/instance/all_spec.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Instance::All do
+RSpec.describe QA::Scenario::Test::Instance::All do
it_behaves_like 'a QA scenario class'
end
diff --git a/qa/spec/scenario/test/instance/smoke_spec.rb b/qa/spec/scenario/test/instance/smoke_spec.rb
index 6cc71699be9..09d0df2c479 100644
--- a/qa/spec/scenario/test/instance/smoke_spec.rb
+++ b/qa/spec/scenario/test/instance/smoke_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Instance::Smoke do
+RSpec.describe QA::Scenario::Test::Instance::Smoke do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:smoke] }
end
diff --git a/qa/spec/scenario/test/integration/github_spec.rb b/qa/spec/scenario/test/integration/github_spec.rb
index b2d577bd552..b68b06a7b9f 100644
--- a/qa/spec/scenario/test/integration/github_spec.rb
+++ b/qa/spec/scenario/test/integration/github_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::Github do
+RSpec.describe QA::Scenario::Test::Integration::Github do
describe '#perform' do
let(:env) { spy('Runtime::Env') }
diff --git a/qa/spec/scenario/test/integration/instance_saml_spec.rb b/qa/spec/scenario/test/integration/instance_saml_spec.rb
index 15f15b2e643..20e860d3e4b 100644
--- a/qa/spec/scenario/test/integration/instance_saml_spec.rb
+++ b/qa/spec/scenario/test/integration/instance_saml_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::InstanceSAML do
+RSpec.describe QA::Scenario::Test::Integration::InstanceSAML do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:instance_saml] }
diff --git a/qa/spec/scenario/test/integration/kubernetes_spec.rb b/qa/spec/scenario/test/integration/kubernetes_spec.rb
index 51ee7b9acff..d5885b97343 100644
--- a/qa/spec/scenario/test/integration/kubernetes_spec.rb
+++ b/qa/spec/scenario/test/integration/kubernetes_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::Kubernetes do
+RSpec.describe QA::Scenario::Test::Integration::Kubernetes do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:kubernetes] }
diff --git a/qa/spec/scenario/test/integration/ldap_spec.rb b/qa/spec/scenario/test/integration/ldap_spec.rb
index c493cde6c7a..c53302d9bd3 100644
--- a/qa/spec/scenario/test/integration/ldap_spec.rb
+++ b/qa/spec/scenario/test/integration/ldap_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::LDAPNoTLS do
+RSpec.describe QA::Scenario::Test::Integration::LDAPNoTLS do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_no_tls] }
@@ -8,7 +8,7 @@ describe QA::Scenario::Test::Integration::LDAPNoTLS do
end
end
-describe QA::Scenario::Test::Integration::LDAPNoServer do
+RSpec.describe QA::Scenario::Test::Integration::LDAPNoServer do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_no_server] }
@@ -16,7 +16,7 @@ describe QA::Scenario::Test::Integration::LDAPNoServer do
end
end
-describe QA::Scenario::Test::Integration::LDAPTLS do
+RSpec.describe QA::Scenario::Test::Integration::LDAPTLS do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_tls] }
diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb
index 7e4eb6284e8..9532ec35b95 100644
--- a/qa/spec/scenario/test/integration/mattermost_spec.rb
+++ b/qa/spec/scenario/test/integration/mattermost_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::Mattermost do
+RSpec.describe QA::Scenario::Test::Integration::Mattermost do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:args) { %w[gitlab_address mattermost_address] }
diff --git a/qa/spec/scenario/test/integration/object_storage_spec.rb b/qa/spec/scenario/test/integration/object_storage_spec.rb
index 8b4367bee32..235dd495687 100644
--- a/qa/spec/scenario/test/integration/object_storage_spec.rb
+++ b/qa/spec/scenario/test/integration/object_storage_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Integration::ObjectStorage do
+RSpec.describe QA::Scenario::Test::Integration::ObjectStorage do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:object_storage] }
diff --git a/qa/spec/scenario/test/sanity/framework_spec.rb b/qa/spec/scenario/test/sanity/framework_spec.rb
index a63c59e2995..5ae8b123ec2 100644
--- a/qa/spec/scenario/test/sanity/framework_spec.rb
+++ b/qa/spec/scenario/test/sanity/framework_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Sanity::Framework do
+RSpec.describe QA::Scenario::Test::Sanity::Framework do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:framework] }
end
diff --git a/qa/spec/scenario/test/sanity/selectors_spec.rb b/qa/spec/scenario/test/sanity/selectors_spec.rb
index e18babaed63..2a68dd23219 100644
--- a/qa/spec/scenario/test/sanity/selectors_spec.rb
+++ b/qa/spec/scenario/test/sanity/selectors_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Scenario::Test::Sanity::Selectors do
+RSpec.describe QA::Scenario::Test::Sanity::Selectors do
let(:validator) { spy('validator') }
before do
diff --git a/qa/spec/specs/helpers/quarantine_spec.rb b/qa/spec/specs/helpers/quarantine_spec.rb
index 9686a9771c4..b0b7d4e6804 100644
--- a/qa/spec/specs/helpers/quarantine_spec.rb
+++ b/qa/spec/specs/helpers/quarantine_spec.rb
@@ -36,7 +36,7 @@ RSpec.configure do |c|
end
end
-describe QA::Specs::Helpers::Quarantine do
+RSpec.describe QA::Specs::Helpers::Quarantine do
describe '.skip_or_run_quarantined_contexts' do
context 'with no tag focused' do
before do
diff --git a/qa/spec/specs/parallel_runner_spec.rb b/qa/spec/specs/parallel_runner_spec.rb
index 67d94a1f648..c2d28bf81fb 100644
--- a/qa/spec/specs/parallel_runner_spec.rb
+++ b/qa/spec/specs/parallel_runner_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe QA::Specs::ParallelRunner do
+RSpec.describe QA::Specs::ParallelRunner do
include Helpers::StubENV
before do
diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb
index 361588fa14f..8171cfcb3e6 100644
--- a/qa/spec/specs/runner_spec.rb
+++ b/qa/spec/specs/runner_spec.rb
@@ -2,7 +2,7 @@
require 'active_support/core_ext/hash'
-describe QA::Specs::Runner do
+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])
diff --git a/qa/spec/support/repeater_spec.rb b/qa/spec/support/repeater_spec.rb
index b5d5058ef49..18ccbf250cb 100644
--- a/qa/spec/support/repeater_spec.rb
+++ b/qa/spec/support/repeater_spec.rb
@@ -4,7 +4,7 @@ require 'logger'
require 'timecop'
require 'active_support/core_ext/integer/time'
-describe QA::Support::Repeater do
+RSpec.describe QA::Support::Repeater do
before do
logger = ::Logger.new $stdout
logger.level = ::Logger::DEBUG
diff --git a/qa/spec/support/retrier_spec.rb b/qa/spec/support/retrier_spec.rb
index ef1d53e6b65..6f052519516 100644
--- a/qa/spec/support/retrier_spec.rb
+++ b/qa/spec/support/retrier_spec.rb
@@ -3,7 +3,7 @@
require 'logger'
require 'timecop'
-describe QA::Support::Retrier do
+RSpec.describe QA::Support::Retrier do
before do
logger = ::Logger.new $stdout
logger.level = ::Logger::DEBUG
diff --git a/qa/spec/support/wait_for_requests_spec.rb b/qa/spec/support/wait_for_requests_spec.rb
index 79ee3eb5099..47c35addd9f 100644
--- a/qa/spec/support/wait_for_requests_spec.rb
+++ b/qa/spec/support/wait_for_requests_spec.rb
@@ -1,9 +1,8 @@
# frozen_string_literal: true
-describe QA::Support::WaitForRequests do
+RSpec.describe QA::Support::WaitForRequests do
describe '.wait_for_requests' do
before do
- allow(subject).to receive(:finished_all_axios_requests?).and_return(true)
allow(subject).to receive(:finished_all_ajax_requests?).and_return(true)
allow(subject).to receive(:finished_loading?).and_return(true)
end
diff --git a/qa/spec/support/waiter_spec.rb b/qa/spec/support/waiter_spec.rb
index 35f1e01289a..5b0c2c95d0d 100644
--- a/qa/spec/support/waiter_spec.rb
+++ b/qa/spec/support/waiter_spec.rb
@@ -2,7 +2,7 @@
require 'logger'
-describe QA::Support::Waiter do
+RSpec.describe QA::Support::Waiter do
before do
logger = ::Logger.new $stdout
logger.level = ::Logger::DEBUG