Commit f72f97e1 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Mark token encryption job as completed when there are no users

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/356874

It is an edge case, however it needs to be fixed.

Changelog: fixed
parent 862882ba
...@@ -52,9 +52,9 @@ module Gitlab ...@@ -52,9 +52,9 @@ module Gitlab
WHERE cte_id = id WHERE cte_id = id
SQL SQL
end end
mark_job_as_succeeded(start_id, end_id)
end end
mark_job_as_succeeded(start_id, end_id)
end end
private private
......
...@@ -39,6 +39,14 @@ RSpec.describe Gitlab::BackgroundMigration::EncryptStaticObjectToken do ...@@ -39,6 +39,14 @@ RSpec.describe Gitlab::BackgroundMigration::EncryptStaticObjectToken do
expect(new_state[user_with_encrypted_token.id]).to match_array([nil, 'encrypted']) expect(new_state[user_with_encrypted_token.id]).to match_array([nil, 'encrypted'])
end end
context 'when id range does not include existing user ids' do
let(:arguments) { [non_existing_record_id, non_existing_record_id.succ] }
it_behaves_like 'marks background migration job records' do
subject { described_class.new }
end
end
private private
def create_user!(name:, token: nil, encrypted_token: nil) def create_user!(name:, token: nil, encrypted_token: nil)
......
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