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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/feature_spec.rb')
-rw-r--r--spec/lib/feature_spec.rb57
1 files changed, 2 insertions, 55 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb
index c86bc36057a..044415b9952 100644
--- a/spec/lib/feature_spec.rb
+++ b/spec/lib/feature_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do
+RSpec.describe Feature, :clean_gitlab_redis_feature_flag, stub_feature_flags: false, feature_category: :shared do
include StubVersion
before do
@@ -11,32 +11,6 @@ RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do
skip_feature_flags_yaml_validation
end
- describe '.feature_flags_available?' do
- it 'returns false on connection error' do
- expect(ActiveRecord::Base.connection).to receive(:active?).and_raise(PG::ConnectionBad) # rubocop:disable Database/MultipleDatabases
-
- expect(described_class.feature_flags_available?).to eq(false)
- end
-
- it 'returns false when connection is not active' do
- expect(ActiveRecord::Base.connection).to receive(:active?).and_return(false) # rubocop:disable Database/MultipleDatabases
-
- expect(described_class.feature_flags_available?).to eq(false)
- end
-
- it 'returns false when the flipper table does not exist' do
- expect(Feature::FlipperFeature).to receive(:table_exists?).and_return(false)
-
- expect(described_class.feature_flags_available?).to eq(false)
- end
-
- it 'returns false on NoDatabaseError' do
- expect(Feature::FlipperFeature).to receive(:table_exists?).and_raise(ActiveRecord::NoDatabaseError)
-
- expect(described_class.feature_flags_available?).to eq(false)
- end
- end
-
describe '.get' do
let(:feature) { double(:feature) }
let(:key) { 'my_feature' }
@@ -154,17 +128,6 @@ RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do
end
end
- describe '.register_feature_groups' do
- before do
- Flipper.unregister_groups
- described_class.register_feature_groups
- end
-
- it 'registers expected groups' do
- expect(Flipper.groups).to include(an_object_having_attributes(name: :gitlab_team_members))
- end
- end
-
describe '.enabled?' do
before do
allow(Feature).to receive(:log_feature_flag_states?).and_return(false)
@@ -249,7 +212,7 @@ RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do
end
it { expect(described_class.send(:l1_cache_backend)).to eq(Gitlab::ProcessMemoryCache.cache_backend) }
- it { expect(described_class.send(:l2_cache_backend)).to eq(Rails.cache) }
+ it { expect(described_class.send(:l2_cache_backend)).to eq(Gitlab::Redis::FeatureFlag.cache_store) }
it 'caches the status in L1 and L2 caches',
:request_store, :use_clean_rails_memory_store_caching do
@@ -361,22 +324,6 @@ RSpec.describe Feature, stub_feature_flags: false, feature_category: :shared do
end
end
- context 'with gitlab_team_members feature group' do
- let(:actor) { build_stubbed(:user) }
-
- before do
- Flipper.unregister_groups
- described_class.register_feature_groups
- described_class.enable(:enabled_feature_flag, :gitlab_team_members)
- end
-
- it 'delegates check to FeatureGroups::GitlabTeamMembers' do
- expect(FeatureGroups::GitlabTeamMembers).to receive(:enabled?).with(actor)
-
- described_class.enabled?(:enabled_feature_flag, actor)
- end
- end
-
context 'with an individual actor' do
let(:actor) { stub_feature_flag_gate('CustomActor:5') }
let(:another_actor) { stub_feature_flag_gate('CustomActor:10') }