Skip to content

Fix cross-database modification in runner spec factories

Dylan Griffith requested to merge fix-cross-modification-ci-runner-spec into master

What does this MR do and why?

When instantiating a ci_runner using the factory it was previously also instantiating a project, group and user and then when it called save! these would all be persisted in a single transaction along with the ci_runner but this violates our "cross-database transactions" check https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-cross-database-transactions .

As such we can instead call create when instantiating these relations to ensure they are saved before the runner transaction.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading