Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
31c56eec40
commit
e878a8e80f
|
@ -125,7 +125,7 @@ class ContainerRepository < ApplicationRecord
|
|||
end
|
||||
|
||||
event :finish_import do
|
||||
transition %i[pre_importing importing import_aborted] => :import_done
|
||||
transition %i[default pre_importing importing import_aborted] => :import_done
|
||||
end
|
||||
|
||||
event :already_migrated do
|
||||
|
@ -294,7 +294,7 @@ class ContainerRepository < ApplicationRecord
|
|||
def reconcile_import_status(status)
|
||||
case status
|
||||
when 'native'
|
||||
finish_import_as_native
|
||||
finish_import_as(:native_import)
|
||||
when *IRRECONCILABLE_MIGRATIONS_STATUSES
|
||||
nil
|
||||
when 'import_complete'
|
||||
|
@ -321,9 +321,9 @@ class ContainerRepository < ApplicationRecord
|
|||
when :ok
|
||||
return true
|
||||
when :not_found
|
||||
skip_import(reason: :not_found)
|
||||
finish_import_as(:not_found)
|
||||
when :already_imported
|
||||
finish_import_as_native
|
||||
finish_import_as(:native_import)
|
||||
else
|
||||
abort_import
|
||||
end
|
||||
|
@ -513,8 +513,8 @@ class ContainerRepository < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def finish_import_as_native
|
||||
self.migration_skipped_reason = :native_import
|
||||
def finish_import_as(reason)
|
||||
self.migration_skipped_reason = reason
|
||||
finish_import
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20533,8 +20533,8 @@ Field that are available while modifying the custom mapping attributes for an HT
|
|||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| <a id="complianceviolationinputmergedafter"></a>`mergedAfter` | [`Date`](#date) | Merged date of merge requests merged after a compliance violation was created. |
|
||||
| <a id="complianceviolationinputmergedbefore"></a>`mergedBefore` | [`Date`](#date) | Merged date of merge requests merged before a compliance violation was created. |
|
||||
| <a id="complianceviolationinputmergedafter"></a>`mergedAfter` | [`Date`](#date) | Merge requests merged after this date (inclusive). |
|
||||
| <a id="complianceviolationinputmergedbefore"></a>`mergedBefore` | [`Date`](#date) | Merge requests merged before this date (inclusive). |
|
||||
| <a id="complianceviolationinputprojectids"></a>`projectIds` | [`[ProjectID!]`](#projectid) | Filter compliance violations by project. |
|
||||
|
||||
### `DastProfileCadenceInput`
|
||||
|
|
|
@ -132,6 +132,16 @@ RSpec.describe ContainerRepository, :aggregate_failures do
|
|||
.and change { repository.reload.migration_skipped_reason }.to('native_import')
|
||||
end
|
||||
end
|
||||
|
||||
context 'non-existing repository' do
|
||||
it 'finishes the import' do
|
||||
expect(repository).to receive(:migration_pre_import).and_return(:not_found)
|
||||
|
||||
expect { subject }
|
||||
.to change { repository.reload.migration_state }.to('import_done')
|
||||
.and change { repository.reload.migration_skipped_reason }.to('not_found')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'transitioning to importing', skip_import_success: true do
|
||||
|
@ -283,7 +293,7 @@ RSpec.describe ContainerRepository, :aggregate_failures do
|
|||
|
||||
subject { repository.finish_import }
|
||||
|
||||
it_behaves_like 'transitioning from allowed states', %w[pre_importing importing import_aborted]
|
||||
it_behaves_like 'transitioning from allowed states', %w[default pre_importing importing import_aborted]
|
||||
it_behaves_like 'queueing the next import'
|
||||
|
||||
it 'sets migration_import_done_at and queues the next import' do
|
||||
|
@ -1155,10 +1165,10 @@ RSpec.describe ContainerRepository, :aggregate_failures do
|
|||
context 'not found response' do
|
||||
let(:response) { :not_found }
|
||||
|
||||
it 'aborts the migration' do
|
||||
it 'completes the migration' do
|
||||
expect(subject).to eq(false)
|
||||
|
||||
expect(container_repository).to be_import_skipped
|
||||
expect(container_repository).to be_import_done
|
||||
expect(container_repository.reload.migration_skipped_reason).to eq('not_found')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue