Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/container_registry/client_spec.rb')
-rw-r--r--spec/lib/container_registry/client_spec.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/lib/container_registry/client_spec.rb b/spec/lib/container_registry/client_spec.rb
index a1425169dee..39409cf8d3a 100644
--- a/spec/lib/container_registry/client_spec.rb
+++ b/spec/lib/container_registry/client_spec.rb
@@ -89,13 +89,14 @@ RSpec.describe ContainerRegistry::Client do
it_behaves_like 'handling timeouts'
end
- shared_examples 'handling repository info' do
+ shared_examples 'handling registry info' do
context 'when the check is successful' do
context 'when using the GitLab container registry' do
before do
stub_registry_info(headers: {
'GitLab-Container-Registry-Version' => '2.9.1-gitlab',
- 'GitLab-Container-Registry-Features' => 'a,b,c'
+ 'GitLab-Container-Registry-Features' => 'a,b,c',
+ 'GitLab-Container-Registry-Database-Enabled' => 'true'
})
end
@@ -106,6 +107,10 @@ RSpec.describe ContainerRegistry::Client do
it 'identifies version and features' do
expect(subject).to include(version: '2.9.1-gitlab', features: %w[a b c])
end
+
+ it 'identifies the registry DB as enabled' do
+ expect(subject).to include(db_enabled: true)
+ end
end
context 'when using a third-party container registry' do
@@ -120,6 +125,10 @@ RSpec.describe ContainerRegistry::Client do
it 'does not identify version or features' do
expect(subject).to include(version: nil, features: [])
end
+
+ it 'does not identify the registry DB as enabled' do
+ expect(subject).to include(db_enabled: false)
+ end
end
end
@@ -130,6 +139,16 @@ RSpec.describe ContainerRegistry::Client do
expect(subject).to eq({})
end
end
+
+ context 'when the check returns an unexpected value in the database enabled header' do
+ it 'does not identify the registry DB as enabled' do
+ stub_registry_info(headers: {
+ 'GitLab-Container-Registry-Database-Enabled' => '123'
+ })
+
+ expect(subject).to include(db_enabled: false)
+ end
+ end
end
describe '#repository_manifest' do
@@ -360,7 +379,7 @@ RSpec.describe ContainerRegistry::Client do
describe '#registry_info' do
subject { client.registry_info }
- it_behaves_like 'handling repository info'
+ it_behaves_like 'handling registry info'
end
describe '.supports_tag_delete?' do
@@ -446,7 +465,7 @@ RSpec.describe ContainerRegistry::Client do
stub_container_registry_config(enabled: true, api_url: registry_api_url, key: 'spec/fixtures/x509_certificate_pk.key')
end
- it_behaves_like 'handling repository info'
+ it_behaves_like 'handling registry info'
end
def stub_upload(path, content, digest, status = 200)