diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-06-07 19:01:35 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-06-07 19:01:35 +0900 |
commit | 0fa07d24c277e30e438086b69c159bc59f25e87e (patch) | |
tree | effd99bce310c2d11c7cf110c963bf3d1b437b75 /spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb | |
parent | 378011229864c1e056cf995444f947f6b352172c (diff) | |
download | gitlab-ce-add-background-migration-for-legacy-traces-with-id-list.tar.gz |
Use id list to select only batch number of rowsadd-background-migration-for-legacy-traces-with-id-list
Diffstat (limited to 'spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb b/spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb index 730968ec887..1d9f63fc9ec 100644 --- a/spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb +++ b/spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb @@ -54,11 +54,11 @@ describe Gitlab::BackgroundMigration::MigrateLegacyArtifacts, :migration, schema expect(job_artifacts.count).to be_zero end - context 'when the record exists inside of the range of a background migration' do - let(:range) { [1, 1] } + context 'when the record exists inside of the id_list of a background migration' do + let(:id_list) { [1] } it 'migrates' do - described_class.new.perform(*range) + described_class.new.perform(id_list) expect(job_artifacts.order(:id).pluck('project_id, job_id, file_type, file_store, size, expire_at, file, file_sha256, file_location')) .to eq([[project_id, job_id, file_type_archive, file_store, artifacts_archive_attributes[:artifacts_size], artifacts_expire_at, 'archive.zip', nil, file_location_legacy_path], @@ -74,7 +74,7 @@ describe Gitlab::BackgroundMigration::MigrateLegacyArtifacts, :migration, schema it 'fills file_store by 1 (ObjectStorage::Store::LOCAL)' do expect(jobs.pluck('artifacts_file_store, artifacts_metadata_store')).to eq([[nil, nil]]) - described_class.new.perform(*range) + described_class.new.perform(id_list) expect(job_artifacts.pluck('file_store')).to eq([1, 1]) end @@ -87,7 +87,7 @@ describe Gitlab::BackgroundMigration::MigrateLegacyArtifacts, :migration, schema end it 'migrates metadata too' do - described_class.new.perform(*range) + described_class.new.perform(id_list) expect(job_artifacts.where(job_id: job_id, file_type: 2).pluck('file')).to eq(['metadata.gz']) end @@ -100,17 +100,17 @@ describe Gitlab::BackgroundMigration::MigrateLegacyArtifacts, :migration, schema end it 'does not migrate' do - expect { described_class.new.perform(*range) }.not_to change { job_artifacts.count } + expect { described_class.new.perform(id_list) }.not_to change { job_artifacts.count } end end end end - context 'when the record exists outside of the range of a background migration' do - let(:range) { [2, 2] } + context 'when the record exists outside of the id_list of a background migration' do + let(:id_list) { [2] } it 'does not migrate' do - described_class.new.perform(*range) + described_class.new.perform(id_list) expect(job_artifacts.count).to be_zero end @@ -127,11 +127,11 @@ describe Gitlab::BackgroundMigration::MigrateLegacyArtifacts, :migration, schema expect(jobs.pluck('artifacts_metadata, artifacts_metadata_store')).to eq([[nil, nil]]) end - context 'when the record exists inside of the range of a background migration' do - let(:range) { [1, 1] } + context 'when the record exists inside of the id_list of a background migration' do + let(:id_list) { [1] } it 'does not migrate' do - described_class.new.perform(*range) + described_class.new.perform(id_list) expect(job_artifacts.count).to be_zero end |