Commit fbac9974 authored by James Fargher's avatar James Fargher

Merge branch 'mk/fix-synchronization-disabled' into 'master'

Geo: Fix inaccurate "Synchronization disabled" progress bars

Closes #221069

See merge request gitlab-org/gitlab!36492
parents c1e434dc 2e7248c0
...@@ -41,8 +41,4 @@ class Geo::JobArtifactRegistry < Geo::BaseRegistry ...@@ -41,8 +41,4 @@ class Geo::JobArtifactRegistry < Geo::BaseRegistry
delete_worker_class.perform_async(:job_artifact, artifact_id) delete_worker_class.perform_async(:job_artifact, artifact_id)
end end
end end
def self.replication_enabled?
JobArtifactUploader.object_store_enabled? ? Gitlab::Geo.current_node.sync_object_storage? : true
end
end end
...@@ -60,10 +60,6 @@ class Geo::UploadRegistry < Geo::BaseRegistry ...@@ -60,10 +60,6 @@ class Geo::UploadRegistry < Geo::BaseRegistry
end end
end end
def self.replication_enabled?
FileUploader.object_store_enabled? ? Gitlab::Geo.current_node.sync_object_storage? : true
end
def file def file
upload&.path || s_('Removed %{type} with id %{id}') % { type: file_type, id: file_id } upload&.path || s_('Removed %{type} with id %{id}') % { type: file_type, id: file_id }
end end
......
---
title: 'Geo: Fix Attachments and Job artifacts showing "Synchronization disabled"'
merge_request: 36492
author:
type: fixed
...@@ -23,30 +23,4 @@ RSpec.describe Geo::JobArtifactRegistry, :geo do ...@@ -23,30 +23,4 @@ RSpec.describe Geo::JobArtifactRegistry, :geo do
expect(described_class.where(id: ids).pluck(:success)).to eq([false]) expect(described_class.where(id: ids).pluck(:success)).to eq([false])
end end
end end
describe '.replication_enabled?' do
context 'when Object Storage is enabled' do
before do
allow(JobArtifactUploader).to receive(:object_store_enabled?).and_return(true)
end
it 'returns true when Geo Object Storage replication is enabled' do
stub_current_geo_node(double(sync_object_storage?: true))
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_truthy
end
it 'returns false when Geo Object Storage replication is disabled' do
stub_current_geo_node(double(sync_object_storage?: false))
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_falsey
end
end
it 'returns true when Object Storage is disabled' do
allow(JobArtifactUploader).to receive(:object_store_enabled?).and_return(false)
expect(Geo::JobArtifactRegistry.replication_enabled?).to be_truthy
end
end
end end
...@@ -107,28 +107,4 @@ RSpec.describe Geo::UploadRegistry, :geo, :geo_fdw do ...@@ -107,28 +107,4 @@ RSpec.describe Geo::UploadRegistry, :geo, :geo_fdw do
expect(failed.synchronization_state).to eq(:failed) expect(failed.synchronization_state).to eq(:failed)
end end
end end
describe '.replication_enabled?' do
context 'when Object Storage is enabled' do
before do
allow(FileUploader).to receive(:object_store_enabled?).and_return(true)
end
it 'returns true when Geo Object Storage replication is enabled' do
stub_current_geo_node(double(sync_object_storage?: true))
expect(Geo::UploadRegistry.replication_enabled?).to be_truthy
end
it 'returns false when Geo Object Storage replication is disabled' do
stub_current_geo_node(double(sync_object_storage?: false))
expect(Geo::UploadRegistry.replication_enabled?).to be_falsey
end
end
it 'returns true when Object Storage is disabled' do
expect(Geo::UploadRegistry.replication_enabled?).to be_truthy
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