Skip to content

Explicitly require runner owners in specs

What does this MR do and why?

🚨 NOTE: There is urgency in getting this MR and !166916 (merged) merged soon, since they unblock batched background migrations that must make it to %17.5 (which is a required stop), so we can finalize them in %17.6 🚨

Ensure that all runner objects are valid models, by enforcing the existence of an owner for project and group runners. Previously, it was usual for brevity to do something like:

let(:runner) { create(:ci_runner, :project) }

This would be successful, even though we weren't implicitly creating a project behind the scenes, and therefore the runner wasn't representing a valid state. We now enforce the requirement that a runner is associated with a group or a project. We lean on the pre-existing :without_projects trait to determine if the runner is supposed not to have projects, and therefore refrain from raising an error in the factory.

Part of #493256 (closed)

Context: !166916 (comment 2130033764)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pedro Pombeiro

Merge request reports

Loading