Fix broken tests on container repository
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
How to set up and validate locally
bundle exec rspec spec/requests/api/graphql/container_repository/container_repository_details_spec.rb
Related to #439529