Skip to content

Spec failure in `spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb` | FixTotalStageInVsa deduplicates issue_metrics table

Job #1361767034 failed for 6700c65b:

Trace

Failures:
  1) FixTotalStageInVsa deduplicates issue_metrics table
     Failure/Error: 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) }
     ActiveRecord::RecordNotUnique:
       PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_analytics_ca_group_stages_on_group_id_and_name"
       DETAIL:  Key (group_id, name)=(45, Total) already exists.
     # ./spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb:17:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:384:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:375:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:371:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:371:in `block (2 levels) in <top (required)>'
     # ./spec/support/database_cleaner.rb:58:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # PG::UniqueViolation:
     #   ERROR:  duplicate key value violates unique constraint "index_analytics_ca_group_stages_on_group_id_and_name"
     #   DETAIL:  Key (group_id, name)=(45, Total) already exists.
     #   ./spec/migrations/20210601073400_fix_total_stage_in_vsa_spec.rb:17:in `block (2 levels) in <top (required)>'