Skip to content

RSpec: Ensure projects assigned to runners are scoped to the same organization

Rutger Wessels requested to merge 411832-assign-projects-to-runners-in-spec into master

What does this MR do and why?

As part of the Cells project, we are introducing Organizations. All namespaces will be associated with one Organization.

In this Draft MR, a validation is added: all namespaces need to have an organization. That MR turned out to be quite large so I decided to split up the MR.

This MR will fix Runner-related tests that will break when we validate presence of Organization on the Namespace model. The errors are all similar:

  • Specs that used different projects raised errors: runner can only be assigned to projects in the same organization
  • The Namespace factory will create an organization.
  • The Project factory will inherit the organization from the namespace
  • Before adding the validation, this was no issue: we compared nil to nil because the project organization was nil
  • After we add the validation, the organizations will not match so the error was raised

This can be fixed by ensuring the organizations assigned to the projects are the same.

There are no application changes in this MR.

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.

How to set up and validate locally

Run the specs. They should be green

Related to #411832

Edited by Rutger Wessels

Merge request reports