gitlab-org--gitlab-foss/spec/factories/pool_repositories.rb
Zeger-Jan van de Weg 752e9c18a1
Leave object pools when destroying projects
This action doesn't lean on reduplication, so a short call can me made
to the Gitaly server to have the object pool remove its remote to the
project pending deletion.
https://gitlab.com/gitlab-org/gitaly/blob/f6cd55357/internal/git/objectpool/link.go#L58

When an object pool doesn't have members, this would invalidate the need
for a pool. So when a project leaves the pool, the pool will be
destroyed on the background.

Fixes: https://gitlab.com/gitlab-org/gitaly/issues/1415
2018-12-19 13:21:56 +01:00

30 lines
495 B
Ruby

FactoryBot.define do
factory :pool_repository do
shard { Shard.by_name("default") }
state :none
before(:create) do |pool|
pool.source_project = create(:project, :repository)
end
trait :scheduled do
state :scheduled
end
trait :failed do
state :failed
end
trait :obsolete do
state :obsolete
end
trait :ready do
state :ready
after(:create) do |pool|
pool.create_object_pool
end
end
end
end