diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb')
-rw-r--r-- | spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb b/spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb new file mode 100644 index 00000000000..36d85d1f745 --- /dev/null +++ b/spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration!('fix_total_stage_in_vsa') + +RSpec.describe FixTotalStageInVsa, :migration, schema: 20210518001450 do + let(:namespaces) { table(:namespaces) } + let(:group_value_streams) { table(:analytics_cycle_analytics_group_value_streams) } + let(:group_stages) { table(:analytics_cycle_analytics_group_stages) } + + let!(:group) { namespaces.create!(name: 'ns1', path: 'ns1', type: 'Group') } + let!(:group_vs_1) { group_value_streams.create!(name: 'default', group_id: group.id) } + let!(:group_vs_2) { group_value_streams.create!(name: 'other', group_id: group.id) } + let!(:group_vs_3) { group_value_streams.create!(name: 'another', group_id: group.id) } + let!(:group_stage_total) { group_stages.create!(name: 'Total', custom: false, group_id: group.id, group_value_stream_id: group_vs_1.id, start_event_identifier: 1, end_event_identifier: 2) } + let!(:group_stage_different_name) { group_stages.create!(name: 'Issue', custom: false, group_id: group.id, group_value_stream_id: group_vs_2.id, start_event_identifier: 1, end_event_identifier: 2) } + let!(:group_stage_total_custom) { group_stages.create!(name: 'Total', custom: true, group_id: group.id, group_value_stream_id: group_vs_3.id, start_event_identifier: 1, end_event_identifier: 2) } + + it 'deduplicates issue_metrics table' do + migrate! + + group_stage_total.reload + group_stage_different_name.reload + group_stage_total_custom.reload + + expect(group_stage_total.custom).to eq(true) + expect(group_stage_different_name.custom).to eq(false) + expect(group_stage_total_custom.custom).to eq(true) + end +end |