diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 15:30:44 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 15:30:44 +0300 |
commit | 0fd0b64be63c18bb216f15d887e3ce0955dcf269 (patch) | |
tree | f62cd1d970ba738ef0825f745c4c44714a6b126e /spec | |
parent | b337a086d5118e80518945abfc2e88008d9fc1ec (diff) |
Use stages position column to track stage index
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/ci/stages.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/create_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/safe_model_attributes.yml | 2 | ||||
-rw-r--r-- | spec/migrations/schedule_stages_index_migration_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/ci/stage_spec.rb | 12 |
7 files changed, 13 insertions, 13 deletions
diff --git a/spec/factories/ci/stages.rb b/spec/factories/ci/stages.rb index f4f73a67e9a..ce61e6bf759 100644 --- a/spec/factories/ci/stages.rb +++ b/spec/factories/ci/stages.rb @@ -21,7 +21,7 @@ FactoryBot.define do pipeline factory: :ci_empty_pipeline name 'test' - priority 1 + position 1 status 'pending' end end 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 d20d3ebad31..f8107dd40b9 100644 --- a/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb +++ b/spec/lib/gitlab/background_migration/migrate_stage_index_spec.rb @@ -26,10 +26,10 @@ describe Gitlab::BackgroundMigration::MigrateStageIndex, :migration, schema: 201 end it 'correctly migrates stages indices' do - expect(stages.all.pluck(:priority)).to all(be_nil) + expect(stages.all.pluck(:position)).to all(be_nil) described_class.new.perform(100, 101) - expect(stages.all.pluck(:priority)).to eq [2, 3] + expect(stages.all.pluck(:position)).to eq [2, 3] end end diff --git a/spec/lib/gitlab/ci/pipeline/chain/create_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/create_spec.rb index 7513ba15811..0edc3f315bb 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/create_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/create_spec.rb @@ -17,7 +17,7 @@ describe Gitlab::Ci::Pipeline::Chain::Create do context 'when pipeline is ready to be saved' do before do - pipeline.stages.build(name: 'test', priority: 0, project: project) + pipeline.stages.build(name: 'test', position: 0, project: project) step.perform! end diff --git a/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb index b4bd0976268..05ce3412fd8 100644 --- a/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb @@ -25,7 +25,7 @@ describe Gitlab::Ci::Pipeline::Seed::Stage do it 'returns hash attributes of a stage' do expect(subject.attributes).to be_a Hash expect(subject.attributes) - .to include(:name, :priority, :pipeline, :project) + .to include(:name, :position, :pipeline, :project) end end diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index f9d3116de05..62da967cf96 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -232,7 +232,7 @@ Ci::Stage: - id - name - status -- priority +- position - lock_version - project_id - pipeline_id diff --git a/spec/migrations/schedule_stages_index_migration_spec.rb b/spec/migrations/schedule_stages_index_migration_spec.rb index b8d0f711a25..710264da375 100644 --- a/spec/migrations/schedule_stages_index_migration_spec.rb +++ b/spec/migrations/schedule_stages_index_migration_spec.rb @@ -21,7 +21,7 @@ describe ScheduleStagesIndexMigration, :sidekiq, :migration do it 'schedules delayed background migrations in batches' do Sidekiq::Testing.fake! do Timecop.freeze do - expect(stages.all).to all(have_attributes(priority: be_nil)) + expect(stages.all).to all(have_attributes(position: be_nil)) migrate! diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index f6cc61b3e9e..a00db1d2bfc 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -89,9 +89,9 @@ describe Ci::Stage, :models do end describe '#index' do - context 'when stage has been imported and does not have priority index set' do + context 'when stage has been imported and does not have position index set' do before do - stage.update_column(:priority, nil) + stage.update_column(:position, nil) end context 'when stage has statuses' do @@ -100,21 +100,21 @@ describe Ci::Stage, :models do end it 'recalculates index before updating status' do - expect(stage.reload.priority).to be_nil + expect(stage.reload.position).to be_nil stage.update_status - expect(stage.reload.priority).to eq 10 + expect(stage.reload.position).to eq 10 end end context 'when stage does not have statuses' do it 'fallbacks to zero' do - expect(stage.reload.priority).to be_nil + expect(stage.reload.position).to be_nil stage.update_status - expect(stage.reload.priority).to eq 0 + expect(stage.reload.position).to eq 0 end end end |