Commit 65b896d3 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'sh-fix-geo-db-cleaning' into 'master'

Make Geo tracking database work with let_it_be

Closes #232749

See merge request gitlab-org/gitlab!38118
parents c3a3bed1 f7debee7
......@@ -14,7 +14,7 @@ RSpec.describe Geo::BlobVerificationSecondaryService, :geo do
describe '#execute' do
let_it_be(:package_file) { create(:conan_package_file, :conan_recipe_file, verification_checksum: '62fc1ec4ce60') }
let_it_be(:registry) { create(:geo_package_file_registry, :synced, package_file: package_file) }
let!(:registry) { create(:geo_package_file_registry, :synced, package_file: package_file) }
subject(:service) { described_class.new(package_file.replicator) }
......
# frozen_string_literal: true
module EE
class BeforeAllAdapter
def self.begin_transaction
TestProf::BeforeAll::Adapters::ActiveRecord.begin_transaction
::Geo::BaseRegistry.connection.begin_transaction
end
def self.rollback_transaction
TestProf::BeforeAll::Adapters::ActiveRecord.rollback_transaction
::Geo::BaseRegistry.connection.rollback_transaction
end
end
end
......@@ -13,6 +13,7 @@ module EE
def setup_database_cleaner
if ::Gitlab::Geo.geo_database_configured?
::DatabaseCleaner[:active_record, { connection: ::Geo::BaseRegistry }]
TestProf::BeforeAll.adapter = ::EE::BeforeAllAdapter
end
super
......
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