Commit 144b082b authored by Adam Hegyi's avatar Adam Hegyi

Add locking and test case

parent aa91697c
......@@ -7,6 +7,7 @@ class RemoveRequirementsManagementTestReportsBuildIdFk < Gitlab::Database::Migra
def up
with_lock_retries do
execute('LOCK ci_builds, requirements_management_test_reports IN ACCESS EXCLUSIVE MODE')
remove_foreign_key_if_exists(:requirements_management_test_reports, :ci_builds, name: CONSTRAINT_NAME)
end
end
......
......@@ -168,4 +168,9 @@ RSpec.describe RequirementsManagement::TestReport do
end
end
end
it_behaves_like 'cleanup by a loose foreign key' do
let!(:model) { create(:test_report) }
let(:parent) { model.build }
end
end
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