Commit defcee3f authored by Nick Thomas's avatar Nick Thomas

Merge branch 'bvl-disable-git-http-db-writes' into 'master'

Add feature flag to disable db-writes on git fetch over https [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!54322
parents 75e52596 529a7948
......@@ -78,6 +78,8 @@ module Repositories
def update_fetch_statistics
return unless project
return if Gitlab::Database.read_only?
return if Feature.enabled?(:disable_git_http_fetch_writes)
return unless repo_type.project?
OnboardingProgressService.new(project.namespace).execute(action: :git_read)
......
---
name: disable_git_http_fetch_writes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54322
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/883
milestone: '13.9'
type: development
group: group::source code
default_enabled: false
......@@ -36,7 +36,7 @@ RSpec.describe Repositories::GitHttpController do
context 'when project_statistics_sync feature flag is disabled' do
before do
stub_feature_flags(project_statistics_sync: false)
stub_feature_flags(project_statistics_sync: false, disable_git_http_fetch_writes: false)
end
it 'updates project statistics async for projects' do
......@@ -47,6 +47,8 @@ RSpec.describe Repositories::GitHttpController do
end
it 'updates project statistics sync for projects' do
stub_feature_flags(disable_git_http_fetch_writes: false)
expect { send_request }.to change {
Projects::DailyStatisticsFinder.new(container).total_fetch_count
}.from(0).to(1)
......@@ -56,6 +58,29 @@ RSpec.describe Repositories::GitHttpController do
let(:namespace) { project.namespace }
subject { send_request }
before do
stub_feature_flags(disable_git_http_fetch_writes: false)
end
end
context 'when disable_git_http_fetch_writes is enabled' do
before do
stub_feature_flags(disable_git_http_fetch_writes: true)
end
it 'does not increment statistics' do
expect(Projects::FetchStatisticsIncrementService).not_to receive(:new)
expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async)
send_request
end
it 'does not record onboarding progress' do
expect(OnboardingProgressService).not_to receive(:new)
send_request
end
end
end
end
......
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