Commit 4d3eac1a authored by Gabriel Mazetto's avatar Gabriel Mazetto

Added specs for probe_repository_storage

parent b5137acd
...@@ -6,10 +6,6 @@ describe GeoRepositoryDestroyWorker do ...@@ -6,10 +6,6 @@ describe GeoRepositoryDestroyWorker do
let!(:remove_path) { path.sub(/\.git\Z/, "+#{project.id}+deleted.git") } let!(:remove_path) { path.sub(/\.git\Z/, "+#{project.id}+deleted.git") }
let(:perform!) { subject.perform(project.id, project.name, path) } let(:perform!) { subject.perform(project.id, project.name, path) }
before do
project.delete
end
it 'delegates project removal to Projects::DestroyService' do it 'delegates project removal to Projects::DestroyService' do
expect_any_instance_of(::Projects::DestroyService).to receive(:geo_replicate) expect_any_instance_of(::Projects::DestroyService).to receive(:geo_replicate)
...@@ -17,6 +13,10 @@ describe GeoRepositoryDestroyWorker do ...@@ -17,6 +13,10 @@ describe GeoRepositoryDestroyWorker do
end end
context 'sidekiq execution' do context 'sidekiq execution' do
before do
project.delete
end
it 'removes the repository from disk' do it 'removes the repository from disk' do
expect(project.gitlab_shell.exists?(project.repository_storage_path, path + '.git')).to be_truthy expect(project.gitlab_shell.exists?(project.repository_storage_path, path + '.git')).to be_truthy
...@@ -26,4 +26,14 @@ describe GeoRepositoryDestroyWorker do ...@@ -26,4 +26,14 @@ describe GeoRepositoryDestroyWorker do
expect(project.gitlab_shell.exists?(project.repository_storage_path, remove_path + '.git')).to be_falsey expect(project.gitlab_shell.exists?(project.repository_storage_path, remove_path + '.git')).to be_falsey
end end
end end
describe '#probe_repository_storage' do
it 'returns a repository_storage when repository can be found' do
expect(subject.send(:probe_repository_storage, project.path_with_namespace)).to eq('default')
end
it 'returns nil when repository cannot be found in any existing repository_storage' do
expect(subject.send(:probe_repository_storage, 'nonexistent/project')).to eq(nil)
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