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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-19 14:01:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-19 14:01:45 +0300
commit9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch)
tree865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb
parent6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff)
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb42
1 files changed, 32 insertions, 10 deletions
diff --git a/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb b/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb
index f6be45b0cf8..6fb0516e173 100644
--- a/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb
+++ b/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb
@@ -286,21 +286,21 @@ RSpec.shared_examples 'a container registry auth service' do
describe '.push_pull_nested_repositories_access_token' do
let_it_be(:project) { create(:project) }
-
- let(:token) { described_class.push_pull_nested_repositories_access_token(project.full_path) }
+ let(:name) { project.full_path }
+ let(:token) { described_class.push_pull_nested_repositories_access_token(name) }
let(:access) do
[
{
'type' => 'repository',
- 'name' => project.full_path,
+ 'name' => name,
'actions' => %w[pull push],
- 'meta' => { 'project_path' => project.full_path }
+ 'meta' => { 'project_path' => name }
},
{
'type' => 'repository',
- 'name' => "#{project.full_path}/*",
+ 'name' => "#{name}/*",
'actions' => %w[pull],
- 'meta' => { 'project_path' => project.full_path }
+ 'meta' => { 'project_path' => name }
}
]
end
@@ -311,6 +311,12 @@ RSpec.shared_examples 'a container registry auth service' do
expect(payload).to include('access' => access)
end
+ it 'sends the name as the override project path for the access token' do
+ expect(described_class).to receive(:access_token).with(anything, override_project_path: name)
+
+ subject
+ end
+
it_behaves_like 'a valid token'
it_behaves_like 'not a container repository factory'
@@ -1345,9 +1351,9 @@ RSpec.shared_examples 'a container registry auth service' do
describe '#access_token' do
let(:token) { described_class.access_token({ bad_project.full_path => ['pull'] }) }
let(:access) do
- [{ 'type' => 'repository',
- 'name' => bad_project.full_path,
- 'actions' => ['pull'] }]
+ { 'type' => 'repository',
+ 'name' => bad_project.full_path,
+ 'actions' => ['pull'] }
end
subject { { token: token } }
@@ -1355,7 +1361,23 @@ RSpec.shared_examples 'a container registry auth service' do
it_behaves_like 'a valid token'
it 'has the correct scope' do
- expect(payload).to include('access' => access)
+ expect(payload).to include('access' => [access])
+ end
+
+ context 'with an override project path' do
+ let(:override_project_path) { 'group/project-override' }
+ let(:token) do
+ described_class.access_token(
+ { bad_project.full_path => ['pull'] },
+ override_project_path: override_project_path
+ )
+ end
+
+ it 'returns the override project path in the metadata' do
+ expect(payload).to include('access' => [
+ access.merge("meta" => { "project_path" => override_project_path })
+ ])
+ end
end
end
end