Add flag snippet_count_check to GitAccessSnippet

parent 9ce3beb3
......@@ -98,7 +98,10 @@ module Gitlab
def check_single_change_access(change)
Checks::SnippetCheck.new(change, logger: logger).validate!
Checks::PushFileCountCheck.new(change, repository: repository, limit: Snippet::MAX_FILE_COUNT, logger: logger).validate!
if Feature.enabled?(:snippet_count_check)
Checks::PushFileCountCheck.new(change, repository: repository, limit: Snippet::MAX_FILE_COUNT, logger: logger).validate!
end
rescue Checks::TimedLogger::TimeoutError
raise TimeoutError, logger.full_message
end
......
......@@ -209,6 +209,16 @@ describe Gitlab::GitAccessSnippet do
expect { push_access_check }.to raise_forbidden('foo')
end
context 'when feature flag :snippet_count_check is disabled' do
it 'does not check push file count' do
stub_feature_flags(snippet_count_check: false)
expect(Gitlab::Checks::PushFileCountCheck).not_to receive(:new)
expect { push_access_check }.not_to raise_error
end
end
end
private
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment