diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/requests/api/internal/container_registry/migration_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/requests/api/internal/container_registry/migration_spec.rb')
-rw-r--r-- | spec/requests/api/internal/container_registry/migration_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/requests/api/internal/container_registry/migration_spec.rb b/spec/requests/api/internal/container_registry/migration_spec.rb index 35113c66f11..db2918e65f1 100644 --- a/spec/requests/api/internal/container_registry/migration_spec.rb +++ b/spec/requests/api/internal/container_registry/migration_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Internal::ContainerRegistry::Migration do +RSpec.describe API::Internal::ContainerRegistry::Migration, :aggregate_failures do let_it_be_with_reload(:repository) { create(:container_repository) } let(:secret_token) { 'secret_token' } @@ -127,6 +127,12 @@ RSpec.describe API::Internal::ContainerRegistry::Migration do it_behaves_like 'updating the repository migration status', from: 'pre_importing', to: 'import_aborted' end + + context 'with repository in unabortable migration state' do + let(:repository) { create(:container_repository, :import_skipped) } + + it_behaves_like 'returning an error', with_message: 'Wrong migration state (import_skipped)' + end end end @@ -147,6 +153,17 @@ RSpec.describe API::Internal::ContainerRegistry::Migration do it_behaves_like 'returning an error', returning_status: :not_found end + + context 'query read location' do + it 'reads from the primary' do + expect(ContainerRepository).to receive(:find_by_path!).and_wrap_original do |m, *args| + expect(::Gitlab::Database::LoadBalancing::Session.current.use_primary?).to eq(true) + m.call(*args) + end + + subject + end + end end context 'with an invalid sent token' do |