summaryrefslogtreecommitdiff
path: root/spec/lib/feature
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-06-12 16:20:01 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-06-18 13:33:43 +0200
commit4dfaaf40b9c6754157adff3704a8036b440148b3 (patch)
tree64587b50e0c0f5d17fa9106fda0a41bfee7de154 /spec/lib/feature
parent968674e41798c437b9ebf4a9731fe2f2a4f07024 (diff)
downloadgitlab-ce-4dfaaf40b9c6754157adff3704a8036b440148b3.tar.gz
Turn on Cat-File cache by default
The feature flag has been introduced an was turned off by default, now the it will default to be turned on. That change would still allow users to turn this feature off by leveraging the Rails console by running: `Feature.disable("gitaly_catfile-cache")` Another option is to manage the number of items the LRU cache will contain, by updating the `config.toml` for Gitaly. This would be the `catfile_cache_size`: https://gitlab.com/gitlab-org/gitaly/blob/0dcb5c579e63754f557aef91a4fa7a00e5b8b127/config.toml.example#L27 Closes: https://gitlab.com/gitlab-org/gitaly/issues/1712
Diffstat (limited to 'spec/lib/feature')
-rw-r--r--spec/lib/feature/gitaly_spec.rb30
1 files changed, 19 insertions, 11 deletions
diff --git a/spec/lib/feature/gitaly_spec.rb b/spec/lib/feature/gitaly_spec.rb
index 12923e4ec41..0e24a927d4c 100644
--- a/spec/lib/feature/gitaly_spec.rb
+++ b/spec/lib/feature/gitaly_spec.rb
@@ -1,32 +1,40 @@
require 'spec_helper'
describe Feature::Gitaly do
- let(:feature_flag) { "mepmep" }
+ let(:feature_flag) { "mep_mep" }
+
+ before do
+ stub_const("#{described_class}::SERVER_FEATURE_FLAGS", [feature_flag])
+ end
describe ".enabled?" do
context 'when the gate is closed' do
before do
- allow(Feature).to receive(:enabled?).with("gitaly_mepmep").and_return(false)
+ stub_feature_flags(gitaly_mep_mep: false)
end
it 'returns false' do
expect(described_class.enabled?(feature_flag)).to be(false)
end
end
- end
- describe ".server_feature_flags" do
- before do
- stub_const("#{described_class}::SERVER_FEATURE_FLAGS", [feature_flag])
- allow(Feature).to receive(:enabled?).with("gitaly_mepmep").and_return(false)
+ context 'when the flag defaults to on' do
+ it 'returns true' do
+ expect(described_class.enabled?(feature_flag)).to be(true)
+ end
end
+ end
- subject { described_class.server_feature_flags }
+ describe ".server_feature_flags" do
+ context 'when one flag is disabled' do
+ before do
+ stub_feature_flags(gitaly_mep_mep: false)
+ end
- it { is_expected.to be_a(Hash) }
+ subject { described_class.server_feature_flags }
- context 'when one flag is disabled' do
- it { is_expected.to eq("gitaly-feature-mepmep" => "false") }
+ it { is_expected.to be_a(Hash) }
+ it { is_expected.to eq("gitaly-feature-mep-mep" => "false") }
end
end
end