diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb b/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb index 437be125cf0..81874ff7982 100644 --- a/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb +++ b/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb @@ -2,35 +2,33 @@ require 'spec_helper' -describe Gitlab::BackgroundMigration::MigrateStageIndex, schema: 20180420080616 do +RSpec.describe Gitlab::BackgroundMigration::MigrateStageIndex do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:pipelines) { table(:ci_pipelines) } let(:stages) { table(:ci_stages) } let(:jobs) { table(:ci_builds) } + let(:namespace) { namespaces.create(name: 'gitlab-org', path: 'gitlab-org') } + let(:project) { projects.create!(namespace_id: namespace.id, name: 'gitlab', path: 'gitlab') } + let(:pipeline) { pipelines.create!(project_id: project.id, ref: 'master', sha: 'adf43c3a') } + let(:stage1) { stages.create(project_id: project.id, pipeline_id: pipeline.id, name: 'build') } + let(:stage2) { stages.create(project_id: project.id, pipeline_id: pipeline.id, name: 'test') } before do - namespaces.create(id: 10, name: 'gitlab-org', path: 'gitlab-org') - projects.create!(id: 11, namespace_id: 10, name: 'gitlab', path: 'gitlab') - pipelines.create!(id: 12, project_id: 11, ref: 'master', sha: 'adf43c3a') - - stages.create(id: 100, project_id: 11, pipeline_id: 12, name: 'build') - stages.create(id: 101, project_id: 11, pipeline_id: 12, name: 'test') - - jobs.create!(id: 121, commit_id: 12, project_id: 11, - stage_idx: 2, stage_id: 100) - jobs.create!(id: 122, commit_id: 12, project_id: 11, - stage_idx: 2, stage_id: 100) - jobs.create!(id: 123, commit_id: 12, project_id: 11, - stage_idx: 10, stage_id: 100) - jobs.create!(id: 124, commit_id: 12, project_id: 11, - stage_idx: 3, stage_id: 101) + jobs.create!(commit_id: pipeline.id, project_id: project.id, + stage_idx: 2, stage_id: stage1.id) + jobs.create!(commit_id: pipeline.id, project_id: project.id, + stage_idx: 2, stage_id: stage1.id) + jobs.create!(commit_id: pipeline.id, project_id: project.id, + stage_idx: 10, stage_id: stage1.id) + jobs.create!(commit_id: pipeline.id, project_id: project.id, + stage_idx: 3, stage_id: stage2.id) end it 'correctly migrates stages indices' do expect(stages.all.pluck(:position)).to all(be_nil) - described_class.new.perform(100, 101) + described_class.new.perform(stage1.id, stage2.id) expect(stages.all.order(:id).pluck(:position)).to eq [2, 3] end |