Commit 1b116094 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'reset-job-token-scope-enabled-2' into 'master'

Reset job_token_scope_enabled setting to false

See merge request gitlab-org/gitlab!65725
parents f654d44e 1bcecc94
# frozen_string_literal: true
class ResetJobTokenScopeEnabled < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
def up
with_lock_retries do
remove_column :project_ci_cd_settings, :job_token_scope_enabled
add_column :project_ci_cd_settings, :job_token_scope_enabled, :boolean, default: false, null: false
end
end
def down
# Irreversible
end
end
7add197fec50d8da5bcdbca83115558480668c26ad3a3fefc4ab93c07f34f63a
\ No newline at end of file
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe ResetJobTokenScopeEnabled do
let(:settings) { table(:project_ci_cd_settings) }
let(:projects) { table(:projects) }
let(:namespaces) { table(:namespaces) }
let(:namespace) { namespaces.create!(name: 'gitlab', path: 'gitlab-org') }
let(:project_1) { projects.create!(name: 'proj-1', path: 'gitlab-org', namespace_id: namespace.id)}
let(:project_2) { projects.create!(name: 'proj-2', path: 'gitlab-org', namespace_id: namespace.id)}
before do
settings.create!(id: 1, project_id: project_1.id, job_token_scope_enabled: true)
settings.create!(id: 2, project_id: project_2.id, job_token_scope_enabled: false)
end
it 'migrates job_token_scope_enabled to be always false' do
expect { migrate! }
.to change { settings.where(job_token_scope_enabled: false).count }
.from(1).to(2)
end
end
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