Commit 000f07c0 authored by Robert May's avatar Robert May

Fix for transactional seed issue

Seeds run in a transaction so their dependence on
merge_request.metrics was failing due to that now being generated
in an `after_commit` hook.
parent 02ac053a
......@@ -107,6 +107,10 @@ class Gitlab::Seeder::CycleAnalytics
pipeline = FactoryBot.create(:ci_pipeline, :success, project: project)
build = FactoryBot.create(:ci_build, pipeline: pipeline, project: project, user: developers.sample)
# Required because seeds run in a transaction and these are now
# created in an `after_commit` hook.
merge_request.ensure_metrics
merge_request.metrics.update!(
latest_build_started_at: merge_request.created_at,
latest_build_finished_at: within_end_time(merge_request.created_at + TEST_STAGE_MAX_DURATION_IN_HOURS.hours),
......
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