Commit ae3d6f87 authored by Nick Thomas's avatar Nick Thomas

EE-only changes to allow the specs to run on hashed storage

parent 1834df9b
......@@ -250,7 +250,7 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
project = hashed_storage_migrated_event.project
old_disk_path = hashed_storage_migrated_event.old_disk_path
new_disk_path = hashed_storage_migrated_event.new_disk_path
old_storage_version = project.storage_version
old_storage_version = hashed_storage_migrated_event.old_storage_version
expect(::Geo::HashedStorageMigrationWorker).to receive(:perform_async)
.with(project.id, old_disk_path, new_disk_path, old_storage_version)
......
......@@ -102,9 +102,9 @@ describe Namespace do
it 'logs the Geo::RepositoryRenamedEvent for each project inside namespace' do
parent = create(:namespace)
child = create(:group, name: 'child', path: 'child', parent: parent)
project_legacy_storage = create(:project_empty_repo, namespace: parent)
create(:project, :hashed, namespace: child)
create(:project_empty_repo, namespace: child)
project_legacy_storage = create(:project_empty_repo, :legacy_storage, namespace: parent)
create(:project, namespace: child)
create(:project_empty_repo, :legacy_storage, namespace: child)
full_path_was = "#{parent.full_path}_old"
new_path = parent.full_path
......
......@@ -936,11 +936,11 @@ describe Project do
context 'when running on a primary node' do
set(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) }
let(:project) { create(:project, :repository) }
let(:project) { create(:project, :repository, :legacy_storage) }
let(:gitlab_shell) { Gitlab::Shell.new }
it 'logs the Geo::RepositoryRenamedEvent for project backed by hashed storage' do
project_hashed_storage = create(:project, :hashed)
project_hashed_storage = create(:project)
allow(project_hashed_storage).to receive(:gitlab_shell).and_return(gitlab_shell)
allow(project_hashed_storage).to receive(:previous_changes).and_return('path' => ['foo'])
......
require 'spec_helper'
describe Projects::HashedStorage::MigrateRepositoryService do
let(:project) { create(:project, :empty_repo, :wiki_repo) }
let(:project) { create(:project, :empty_repo, :wiki_repo, :legacy_storage) }
let(:service) { described_class.new(project) }
let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
# Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe Geo::FilesExpireService, :geo, :delete do
let(:project) { create(:project) }
let(:project) { create(:project, :legacy_storage) }
let!(:old_full_path) { project.full_path }
subject { described_class.new(project, old_full_path) }
......
require 'spec_helper'
describe Geo::HashedStorageAttachmentsEventStore do
let(:project) { create(:project, :hashed, path: 'bar') }
let(:project) { create(:project, path: 'bar') }
let(:attachments_event) { build(:geo_hashed_storage_attachments_event, project: project) }
set(:secondary_node) { create(:geo_node) }
let(:old_attachments_path) { attachments_event.old_attachments_path }
......
......@@ -5,7 +5,7 @@ def base_path(storage)
end
describe Geo::HashedStorageAttachmentsMigrationService do
let!(:project) { create(:project) }
let!(:project) { create(:project, :legacy_storage) }
let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) }
......
require 'spec_helper'
describe Geo::HashedStorageMigratedEventStore do
let(:project) { create(:project, :hashed, path: 'bar') }
let(:project) { create(:project, path: 'bar') }
set(:secondary_node) { create(:geo_node) }
let(:old_disk_path) { "#{project.namespace.full_path}/foo" }
let(:old_wiki_disk_path) { "#{old_disk_path}.wiki" }
......
require 'spec_helper'
describe Geo::HashedStorageMigrationService do
let!(:project) { create(:project, :repository) }
let!(:project) { create(:project, :repository, :legacy_storage) }
let(:old_path) { project.full_path }
let(:new_path) { "#{old_path}+renamed" }
......@@ -42,7 +42,7 @@ describe Geo::HashedStorageMigrationService do
end
it 'does not move project backed by hashed storage' do
project = create(:project, :repository, :hashed)
project = create(:project, :repository)
service = described_class.new(
project.id,
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Geo::MoveRepositoryService, :geo do
describe '#execute' do
let(:project) { create(:project, :repository, :wiki_repo) }
let(:project) { create(:project, :repository, :wiki_repo, :legacy_storage) }
let(:old_path) { project.full_path }
let(:new_path) { "#{project.full_path}+renamed" }
......
require 'spec_helper'
describe Geo::RenameRepositoryService do
let(:project) { create(:project, :repository) }
let(:project) { create(:project, :repository, :legacy_storage) }
let(:old_path) { project.full_path }
let(:new_path) { "#{old_path}+renamed" }
......@@ -42,7 +42,7 @@ describe Geo::RenameRepositoryService do
end
it 'does not move project backed by hashed storage' do
project_hashed_storage = create(:project, :hashed)
project_hashed_storage = create(:project)
service = described_class.new(project_hashed_storage.id, project_hashed_storage.full_path, new_path)
expect_any_instance_of(Geo::MoveRepositoryService).not_to receive(:execute)
......
......@@ -28,6 +28,8 @@ describe Geo::RepositoryDestroyService do
end
context 'legacy storage project' do
let(:project) { create(:project_empty_repo, :legacy_storage) }
it 'removes the repository from disk' do
project.delete
......@@ -50,8 +52,6 @@ describe Geo::RepositoryDestroyService do
end
context 'hashed storage project' do
let(:project) { create(:project_empty_repo, :hashed) }
it 'removes the repository from disk' do
project.delete
......
......@@ -14,8 +14,8 @@ describe Geo::RepositoriesCleanUpWorker do
context 'legacy storage' do
it 'performs GeoRepositoryDestroyWorker for each project that does not belong to selected namespaces to replicate' do
project_in_synced_group = create(:project, group: synced_group)
unsynced_project = create(:project, :repository)
project_in_synced_group = create(:project, :legacy_storage, group: synced_group)
unsynced_project = create(:project, :repository, :legacy_storage)
disk_path = "#{unsynced_project.namespace.full_path}/#{unsynced_project.path}"
expect(GeoRepositoryDestroyWorker).to receive(:perform_async)
......
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