Commit 9372983b authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'container-registry-migration-phase1-fix' into 'master'

Add container registry migration eligibility flag to all tokens regardless of action [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!67852
parents c1cd9182 4a1c142a
...@@ -124,7 +124,6 @@ module Auth ...@@ -124,7 +124,6 @@ module Auth
end end
def migration_eligible(project, actions) def migration_eligible(project, actions)
return unless actions.include?('push')
return unless Feature.enabled?(:container_registry_migration_phase1) return unless Feature.enabled?(:container_registry_migration_phase1)
# The migration process will start by allowing only specific test and gitlab-org projects using the # The migration process will start by allowing only specific test and gitlab-org projects using the
......
...@@ -17,11 +17,6 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do ...@@ -17,11 +17,6 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do
project.add_developer(current_user) project.add_developer(current_user)
end end
shared_examples 'an unmodified token' do
it_behaves_like 'a valid token'
it { expect(payload['access']).not_to include(have_key('migration_eligible')) }
end
shared_examples 'a modified token with migration eligibility' do |eligible| shared_examples 'a modified token with migration eligibility' do |eligible|
it_behaves_like 'a valid token' it_behaves_like 'a valid token'
it { expect(payload['access']).to include(include('migration_eligible' => eligible)) } it { expect(payload['access']).to include(include('migration_eligible' => eligible)) }
...@@ -71,7 +66,7 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do ...@@ -71,7 +66,7 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do
{ scopes: ["repository:#{project.full_path}:pull"] } { scopes: ["repository:#{project.full_path}:pull"] }
end end
it_behaves_like 'an unmodified token' it_behaves_like 'a modified token'
end end
context 'with push action' do context 'with push action' do
...@@ -82,20 +77,12 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do ...@@ -82,20 +77,12 @@ RSpec.describe Auth::ContainerRegistryAuthenticationService do
it_behaves_like 'a modified token' it_behaves_like 'a modified token'
end end
context 'with multiple actions including push' do context 'with multiple actions' do
let(:current_params) do let(:current_params) do
{ scopes: ["repository:#{project.full_path}:pull,push,delete"] } { scopes: ["repository:#{project.full_path}:pull,push,delete"] }
end end
it_behaves_like 'a modified token' it_behaves_like 'a modified token'
end end
context 'with multiple actions excluding push' do
let(:current_params) do
{ scopes: ["repository:#{project.full_path}:pull,delete"] }
end
it_behaves_like 'an unmodified token'
end
end end
end end
...@@ -69,6 +69,10 @@ RSpec.shared_examples 'a browsable' do ...@@ -69,6 +69,10 @@ RSpec.shared_examples 'a browsable' do
end end
RSpec.shared_examples 'an accessible' do RSpec.shared_examples 'an accessible' do
before do
stub_feature_flags(container_registry_migration_phase1: false)
end
let(:access) do let(:access) do
[{ 'type' => 'repository', [{ 'type' => 'repository',
'name' => project.full_path, 'name' => project.full_path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment