-
Michael Becker authored
I was never able to reproduce this flaky failure locally. Context ------------------- When I look through the code, it looks like this spec is relying on two assumptions: 1. the `gids` of the `FactoryBot` created projects are created in the same sequential order they are defined in the code 2. `Project.all` will always return these projects in the same order I think those two assumptions are possibly the root cause. In the [`Namespace::ProjectsFinder`][0] we end up calling `sort_by_attribute(:similarity)` This eventually falls through to the [sortable concern][1]. As `:similarity` isn't a column or globally defined search, it falls back to the `all` scope. Because of this default, the resulting query has no explicit `ORDER BY` clause, which conflicts with the specs assumption of some sort of order [0]:https://gitlab.com/gitlab-org/gitlab/-/blob/e9ff48e4/app/finders/namespaces/projects_finder.rb#L88 [1]:https://gitlab.com/gitlab-org/gitlab/-/blob/e9ff48e4/app/models/concerns/sortable.rb#L25 Related to https://gitlab.com/gitlab-org/gitlab/-/issues/446251 MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157618
cc363ddc