Ensure organizations are the same for groups created in specs
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 tests that will. break because of tests for number of queries. What happened was:
-
group1 = create(:group)
creates a new group with an associated Organization -
group2 = create(:group)
creates a new group with another organization
This led to a second organization to be created, and therefore additional queries are send to the database. This broke tests that are counting queries (N+1 tests): an additional select from organizations
query was added. By ensuring the organizations are the same for each group creating, the query counts will not break. The reason for the additional query is this line.
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