Skip to content

Fix broken tests on container repository

Adie (she/her) requested to merge 439529-fix-failing-test-on-master into master

We have some broken tests that were identified in gitlab-org/quality/engineering-productivity/master-broken-incidents#6592 (comment 1923264742).

This MR is to fix the tests and refactor a bit. One refactoring is the following:

def migrated_and_can_access_the_gitlab_api?
  migrated? && gitlab_api_client.supports_gitlab_api?
end

Previously, we have used ContainerRegistry::GitlabApiClient.supports_gitlab_api? which creates a new instance of GitlabAPIClient. By reusing the gitlab_api_client of a container repository in gitlab_api_client.supports_gitlab_api?, we don't instantiate a new instance of the GitlabApiClient thus it is also easier to stub methods on an instance of the client.

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

bundle exec rspec spec/requests/api/graphql/container_repository/container_repository_details_spec.rb

Related to #439529 (closed)

Edited by Adie (she/her)

Merge request reports