diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/lib/container_registry/client_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/lib/container_registry/client_spec.rb')
-rw-r--r-- | spec/lib/container_registry/client_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/container_registry/client_spec.rb b/spec/lib/container_registry/client_spec.rb index f9e08df3399..cb2da24b712 100644 --- a/spec/lib/container_registry/client_spec.rb +++ b/spec/lib/container_registry/client_spec.rb @@ -423,6 +423,22 @@ RSpec.describe ContainerRegistry::Client do end end + describe '#repository_tags' do + let(:path) { 'repository/path' } + + subject { client.repository_tags(path) } + + before do + stub_container_registry_config(enabled: true, api_url: registry_api_url, key: 'spec/fixtures/x509_certificate_pk.key') + end + + it 'returns a successful response' do + stub_registry_tags_list(query_params: { n: described_class::DEFAULT_TAGS_PAGE_SIZE }, tags: %w[t1 t2]) + + expect(subject).to eq('tags' => %w[t1 t2]) + end + end + describe '.registry_info' do subject { described_class.registry_info } @@ -458,6 +474,22 @@ RSpec.describe ContainerRegistry::Client do ) end + def stub_registry_tags_list(query_params: {}, status: 200, tags: ['test_tag']) + url = "#{registry_api_url}/v2/#{path}/tags/list" + + unless query_params.empty? + url += "?" + url += query_params.map { |k, v| "#{k}=#{v}" }.join(',') + end + + stub_request(:get, url) + .with(headers: { 'Accept' => ContainerRegistry::Client::ACCEPTED_TYPES.join(', ') }) + .to_return( + status: status, + body: Gitlab::Json.dump(tags: tags), + headers: { 'Content-Type' => 'application/json' }) + end + def expect_new_faraday(times: 1, timeout: true) request_options = timeout ? expected_faraday_request_options : nil expect(Faraday) |