diff --git a/ee/elastic/docs/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.yml b/ee/elastic/docs/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.yml new file mode 100644 index 0000000000000000000000000000000000000000..a60bd4314bab5cac3a3fa67bc6730e5f0c86f4f2 --- /dev/null +++ b/ee/elastic/docs/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.yml @@ -0,0 +1,10 @@ +--- +name: ReindexUsersToUpdateIntegerWithLongTypeSecondAttempt +version: '20250226135126' +description: Reindex users to update integer with long type +group: group::global search +milestone: '17.10' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182733 +obsolete: false +marked_obsolete_by_url: +marked_obsolete_in_milestone: diff --git a/ee/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.rb b/ee/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.rb new file mode 100644 index 0000000000000000000000000000000000000000..d8efef2e6f1fc60dca9095b09cb587f3363b2995 --- /dev/null +++ b/ee/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class ReindexUsersToUpdateIntegerWithLongTypeSecondAttempt < Elastic::Migration + def migrate + Search::Elastic::ReindexingTask.create!(targets: %w[User], options: { skip_pending_migrations_check: true }) + end + + def completed? + true + end +end diff --git a/ee/spec/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt_spec.rb b/ee/spec/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..3868461aaf9150ef66571ab379b1f570a48da778 --- /dev/null +++ b/ee/spec/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' +require File.expand_path( + 'ee/elastic/migrate/20250226135126_reindex_users_to_update_integer_with_long_type_second_attempt.rb' +) + +RSpec.describe ReindexUsersToUpdateIntegerWithLongTypeSecondAttempt, :elastic_delete_by_query, :sidekiq_inline, feature_category: :global_search do + let(:version) { 20250226135126 } + let(:migration) { described_class.new(version) } + + it 'does not have migration options set', :aggregate_failures do + expect(migration).not_to be_batched + expect(migration).not_to be_retry_on_failure + end + + describe '#migrate' do + it 'creates reindexing task with correct target and options' do + expect { migration.migrate }.to change { Search::Elastic::ReindexingTask.count }.by(1) + task = Search::Elastic::ReindexingTask.last + expect(task.targets).to eq(%w[User]) + expect(task.options).to eq('skip_pending_migrations_check' => true) + end + end + + describe '#completed?' do + it 'always returns true' do + expect(migration.completed?).to be_truthy + end + end +end