Commit 963b1420 authored by João Pereira's avatar João Pereira

Fix handling of non-existing repos during registry phase 2 migration

The fix introduced in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83746 has
one problem, it does not set the `migration_import_done_at`
attribute on the ContainerRepository object when the import
is marked as complete. This fixes that.
parent df6a15b8
......@@ -174,7 +174,7 @@ class ContainerRepository < ApplicationRecord
end
end
before_transition %i[importing import_aborted] => :import_done do |container_repository|
before_transition any => :import_done do |container_repository|
container_repository.migration_import_done_at = Time.zone.now
end
......
......@@ -139,7 +139,8 @@ RSpec.describe ContainerRepository, :aggregate_failures do
expect { subject }
.to change { repository.reload.migration_state }.to('import_done')
.and change { repository.reload.migration_skipped_reason }.to('not_found')
.and change { repository.migration_skipped_reason }.to('not_found')
.and change { repository.migration_import_done_at }.from(nil)
end
end
end
......
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