Commit e4194b0b authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'jf_track_project_repo' into 'master'

Add project repository records when creating a project with a repo [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61550
parents 9f0d689c 3a961ce1
......@@ -242,6 +242,8 @@ FactoryBot.define do
branch_name: evaluator.create_branch)
end
project.track_project_repository
end
end
......
......@@ -74,6 +74,7 @@ RSpec.describe 'factories' do
milestone_release
namespace
project_broken_repo
project_repository
prometheus_alert
prometheus_alert_event
prometheus_metric
......@@ -84,6 +85,7 @@ RSpec.describe 'factories' do
release
release_link
self_managed_prometheus_alert_event
shard
users_star_project
wiki_page
wiki_page_meta
......
......@@ -804,9 +804,9 @@ RSpec.describe Namespace do
end
it 'updates the project storage location' do
repository_project_in_parent_group = create(:project_repository, project: project_in_parent_group)
repository_hashed_project_in_subgroup = create(:project_repository, project: hashed_project_in_subgroup)
repository_legacy_project_in_subgroup = create(:project_repository, project: legacy_project_in_subgroup)
repository_project_in_parent_group = project_in_parent_group.project_repository
repository_hashed_project_in_subgroup = hashed_project_in_subgroup.project_repository
repository_legacy_project_in_subgroup = legacy_project_in_subgroup.project_repository
parent.update(path: 'mygroup_moved')
......
......@@ -2238,13 +2238,13 @@ RSpec.describe Project, factory_default: :keep do
end
context 'with projects on legacy storage' do
let(:project) { create(:project, :repository, :legacy_storage) }
let(:project) { create(:project, :legacy_storage) }
it_behaves_like 'tracks storage location'
end
context 'with projects on hashed storage' do
let(:project) { create(:project, :repository) }
let(:project) { create(:project) }
it_behaves_like 'tracks storage location'
end
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe API::ProjectRepositoryStorageMoves do
it_behaves_like 'repository_storage_moves API', 'projects' do
let_it_be(:container) { create(:project, :repository).tap { |project| project.track_project_repository } }
let_it_be(:container) { create(:project, :repository) }
let_it_be(:storage_move) { create(:project_repository_storage_move, :scheduled, container: container) }
let(:repository_storage_move_factory) { :project_repository_storage_move }
let(:bulk_worker_klass) { Projects::ScheduleBulkRepositoryShardMovesWorker }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::ScheduleBulkRepositoryShardMovesService do
it_behaves_like 'moves repository shard in bulk' do
let_it_be_with_reload(:container) { create(:project, :repository).tap { |project| project.track_project_repository } }
let_it_be_with_reload(:container) { create(:project, :repository) }
let(:move_service_klass) { Projects::RepositoryStorageMove }
let(:bulk_worker_klass) { ::Projects::ScheduleBulkRepositoryShardMovesWorker }
......
......@@ -195,8 +195,6 @@ RSpec.describe Projects::TransferService do
end
it 'does not update storage location' do
create(:project_repository, project: project)
attempt_project_transfer
expect(project.project_repository).to have_attributes(
......
......@@ -301,10 +301,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
shared_examples 'includes repositories in all repository storages' do
specify :aggregate_failures do
project_a = create(:project, :repository)
project_a.track_project_repository
project_snippet_a = create(:project_snippet, :repository, project: project_a, author: project_a.owner)
project_b = create(:project, :repository, repository_storage: second_storage_name)
project_b.track_project_repository
project_snippet_b = create(:project_snippet, :repository, project: project_b, author: project_b.owner)
project_snippet_b.snippet_repository.update!(shard: project_b.project_repository.shard)
create(:wiki_page, container: project_a)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe ProjectScheduleBulkRepositoryShardMovesWorker do
it_behaves_like 'schedules bulk repository shard moves' do
let_it_be_with_reload(:container) { create(:project, :repository).tap { |project| project.track_project_repository } }
let_it_be_with_reload(:container) { create(:project, :repository) }
let(:move_service_klass) { Projects::RepositoryStorageMove }
let(:worker_klass) { Projects::UpdateRepositoryStorageWorker }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Projects::ScheduleBulkRepositoryShardMovesWorker do
it_behaves_like 'schedules bulk repository shard moves' do
let_it_be_with_reload(:container) { create(:project, :repository).tap { |project| project.track_project_repository } }
let_it_be_with_reload(:container) { create(:project, :repository) }
let(:move_service_klass) { Projects::RepositoryStorageMove }
let(:worker_klass) { Projects::UpdateRepositoryStorageWorker }
......
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