diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-04 13:43:26 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-04 13:43:26 +0200 |
commit | d60ce6e9f44eba769a6ad595014ae96095169dd2 (patch) | |
tree | 0156fbd625e675332d09f81d6110cbcd2ea3f442 /spec/migrations | |
parent | 7103c4a707157594c261ba2f68fbb649ca4df769 (diff) | |
download | gitlab-ce-d60ce6e9f44eba769a6ad595014ae96095169dd2.tar.gz |
Implement initial working stages statuses migration
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/migrate_stages_statuses_spec.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/migrations/migrate_stages_statuses_spec.rb b/spec/migrations/migrate_stages_statuses_spec.rb index dc54f4acbf4..95fa2977b31 100644 --- a/spec/migrations/migrate_stages_statuses_spec.rb +++ b/spec/migrations/migrate_stages_statuses_spec.rb @@ -15,36 +15,35 @@ describe MigrateStagesStatuses, :migration do projects.create!(id: 1, name: 'gitlab1', path: 'gitlab1') projects.create!(id: 2, name: 'gitlab2', path: 'gitlab2') - pipelines.create!(id: 1, project_id: 123, ref: 'master', sha: 'adf43c3a') - pipelines.create!(id: 2, project_id: 456, ref: 'feature', sha: '21a3deb') + pipelines.create!(id: 1, project_id: 1, ref: 'master', sha: 'adf43c3a') + pipelines.create!(id: 2, project_id: 2, ref: 'feature', sha: '21a3deb') create_job(project: 1, pipeline: 1, stage: 'test', status: 'success') create_job(project: 1, pipeline: 1, stage: 'test', status: 'running') create_job(project: 1, pipeline: 1, stage: 'build', status: 'success') create_job(project: 1, pipeline: 1, stage: 'build', status: 'failed') create_job(project: 2, pipeline: 2, stage: 'test', status: 'success') - create_job(project: 2, pipeline: 2, stage: 'test', status: 'succcss') + create_job(project: 2, pipeline: 2, stage: 'test', status: 'success') - stages.create!(id: 1, pipeline_id: 1, project_id: 1, status: nil) - stages.create!(id: 2, pipeline_id: 1, project_id: 1, status: nil) - stages.create!(id: 3, pipeline_id: 2, project_id: 2, status: nil) + stages.create!(id: 1, pipeline_id: 1, project_id: 1, name: 'test', status: nil) + stages.create!(id: 2, pipeline_id: 1, project_id: 1, name: 'build', status: nil) + stages.create!(id: 3, pipeline_id: 2, project_id: 2, name: 'test', status: nil) end - pending 'correctly migrates stages statuses' do + it 'correctly migrates stages statuses' do expect(stages.where(status: nil).count).to eq 3 migrate! expect(stages.where(status: nil)).to be_empty - expect(stages.all.order(:id, :asc).pluck(:stage)) - .to eq %w[running success failed] + expect(stages.all.order('id ASC').pluck(:status)) + .to eq [STATUSES[:running], STATUSES[:failed], STATUSES[:success]] end def create_job(project:, pipeline:, stage:, status:) stage_idx = STAGES[stage.to_sym] - status_id = STATUSES[status.to_sym] jobs.create!(project_id: project, commit_id: pipeline, - stage_idx: stage_idx, stage: stage, status: status_id) + stage_idx: stage_idx, stage: stage, status: status) end end |