BigW Consortium Gitlab

Commit 1d087e07 by Grzegorz Bizon

Freeze mutable constants in stages migration code

parent 6e9924a2
......@@ -9,7 +9,7 @@ module HasStatus
COMPLETED_STATUSES = %w[success failed canceled skipped].freeze
ORDERED_STATUSES = %w[failed pending running manual canceled success skipped created].freeze
STATUSES_ENUM = { created: 0, pending: 1, running: 2, success: 3,
failed: 4, canceled: 5, skipped: 6, manual: 7 }
failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze
class_methods do
def enumerated_status!
......
......@@ -2,7 +2,7 @@ module Gitlab
module BackgroundMigration
class MigrateStageStatus
STATUSES = { created: 0, pending: 1, running: 2, success: 3,
failed: 4, canceled: 5, skipped: 6, manual: 7 }
failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze
class Build < ActiveRecord::Base
self.table_name = 'ci_builds'
......
......@@ -8,7 +8,7 @@ describe MigrateStagesStatuses, :migration do
let(:projects) { table(:projects) }
STATUSES = { created: 0, pending: 1, running: 2, success: 3,
failed: 4, canceled: 5, skipped: 6, manual: 7 }
failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze
before do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
......@@ -59,9 +59,8 @@ describe MigrateStagesStatuses, :migration do
end
end
def create_job(project:, pipeline:, stage:, status:, **opts)
stages = { test: 1, build: 2, deploy: 3}
stages = { test: 1, build: 2, deploy: 3 }
jobs.create!(project_id: project, commit_id: pipeline,
stage_idx: stages[stage.to_sym], stage: stage,
......
......@@ -419,7 +419,6 @@ describe CommitStatus, :models do
end
end
describe '#locking_enabled?' do
before do
commit_status.lock_version = 100
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment