Do not use hardcoded group path in tests
What does this MR do and why?
Fix failures from gitlab-org/quality/engineering-productivity/master-broken-incidents#606 (closed).
In https://gitlab.com/gitlab-org/gitlab/-/blob/c0f1be66fe74d9fef70f391ccd70d8c3f7c4c74b/ee/spec/services/epics/related_epic_links/list_service_spec.rb#L87 we use hard-coded group path, which leads to the following difference (group1
vs group3
):
(byebug) epic_response(public_epic, relation_path1).slice(:id, :relation_path)
{:id=>46, :relation_path=>"/groups/group1/-/epics/1/related_epic_links/34"}
(byebug) subject[0].slice(:id, :relation_path)
{:id=>46, :relation_path=>"/groups/group3/-/epics/1/related_epic_links/34"}
This happens when there is group already created in another test (and persisted with let_it_be
), so it gets the group1
path, and the one from the failing spec gets a different one, e.g. group3
.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
On current master branch run
bundle exec rspec ./ee/spec/models/audit_events/external_audit_event_destination_spec.rb ./ee/spec/services/epics/related_epic_links/list_service_spec.rb
There will be failures, as described in the incident issue.
When the same tests are executed on this branch, failures are gone.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.