Commit 9abb9800 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by Nick Thomas

Fix creation query for pools repository

parent b9ccf013
......@@ -2014,12 +2014,12 @@ class Project < ActiveRecord::Base
def create_new_pool_repository
pool = begin
create_or_find_pool_repository!(shard: Shard.by_name(repository_storage), source_project: self)
create_pool_repository!(shard: Shard.by_name(repository_storage), source_project: self)
rescue ActiveRecord::RecordNotUnique
retry
pool_repository(true)
end
pool.schedule
pool.schedule unless pool.scheduled?
pool
end
......
......@@ -4102,6 +4102,29 @@ describe Project do
end
end
describe '#object_pool_params' do
let(:project) { create(:project, :repository, :public) }
subject { project.object_pool_params }
before do
stub_application_setting(hashed_storage_enabled: true)
end
context 'when the objects cannot be pooled' do
let(:project) { create(:project, :repository, :private) }
it { is_expected.to be_empty }
end
context 'when a pool is created' do
it 'returns that pool repository' do
expect(subject).not_to be_empty
expect(subject[:pool_repository]).to be_persisted
end
end
end
describe '#git_objects_poolable?' do
subject { project }
......
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