Commit 97488d16 authored by Toon Claes's avatar Toon Claes

Use trait to create project with broken storage

Don't use `repository_storage: 'broken'`, but instead use the
`:broken_storage` trait.
parent 4df63116
......@@ -13,7 +13,7 @@ describe Geo::AttachmentRegistryFinder, :geo do
let(:synced_subgroup) { create(:group, parent: synced_group) }
let(:unsynced_group) { create(:group) }
let(:synced_project) { create(:project, group: synced_group) }
let(:unsynced_project) { create(:project, group: unsynced_group, repository_storage: 'broken') }
let(:unsynced_project) { create(:project, :broken_storage, group: unsynced_group) }
let(:upload_1) { create(:upload, model: synced_group) }
let(:upload_2) { create(:upload, model: unsynced_group) }
......
......@@ -359,7 +359,7 @@ describe GeoNode, type: :model do
end
describe '#projects_include?' do
let(:unsynced_project) { create(:project, repository_storage: 'broken') }
let(:unsynced_project) { create(:project, :broken_storage) }
it 'returns true without selective sync' do
expect(node.projects_include?(unsynced_project.id)).to eq true
......@@ -406,7 +406,7 @@ describe GeoNode, type: :model do
let(:nested_group_1) { create(:group, parent: group_1) }
let!(:project_1) { create(:project, group: group_1) }
let!(:project_2) { create(:project, group: nested_group_1) }
let!(:project_3) { create(:project, group: group_2, repository_storage: 'broken') }
let!(:project_3) { create(:project, :broken_storage, group: group_2) }
it 'returns all projects without selective sync' do
expect(node.projects).to match_array([project_1, project_2, project_3])
......
......@@ -24,8 +24,8 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
describe '#perform' do
context 'additional shards' do
it 'skips backfill for repositories on other shards' do
create(:project, group: synced_group, repository_storage: 'broken')
unhealthy_dirty = create(:project, group: synced_group, repository_storage: 'broken')
create(:project, :broken_storage, group: synced_group)
unhealthy_dirty = create(:project, :broken_storage, group: synced_group)
create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty)
allow(Gitlab::GitalyClient).to receive(:call) do
......@@ -68,8 +68,8 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
end
it 'skips backfill for projects with downed Gitaly server' do
create(:project, group: synced_group, repository_storage: 'broken')
unhealthy_dirty = create(:project, group: synced_group, repository_storage: 'broken')
create(:project, :broken_storage, group: synced_group)
unhealthy_dirty = create(:project, :broken_storage, group: synced_group)
create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty)
......
......@@ -18,8 +18,8 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_
describe '#perform' do
it 'skips backfill for repositories on other shards' do
create(:project, repository_storage: 'broken')
unhealthy_outdated = create(:project, repository_storage: 'broken')
create(:project, :broken_storage)
unhealthy_outdated = create(:project, :broken_storage)
create(:repository_state, :repository_outdated, project: unhealthy_outdated)
......@@ -50,8 +50,8 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_
end
it 'skips backfill for projects with downed Gitaly server' do
create(:project, repository_storage: 'broken')
unhealthy_outdated = create(:project, repository_storage: 'broken')
create(:project, :broken_storage)
unhealthy_outdated = create(:project, :broken_storage)
create(:repository_state, :repository_outdated, project: unhealthy_outdated)
......
......@@ -18,7 +18,7 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, :
describe '#perform' do
it 'skips verification for repositories on other shards' do
create(:project, repository_storage: 'broken')
create(:project, :broken_storage)
allow(Gitlab::GitalyClient).to receive(:call) do
raise GRPC::Unavailable.new('No Gitaly available')
......@@ -43,7 +43,7 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, :
end
it 'skips verification for projects with downed Gitaly server' do
create(:project, repository_storage: 'broken')
create(:project, :broken_storage)
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(false, 'broken')])
......
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