Commit de852bce authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'fix-ee-compliance-inline-data-migration-on-ce' into 'master'

Fix compliance framework migration on CE

See merge request gitlab-org/gitlab!46761
parents 6ff0aaff 8511500c
---
title: Fix compliance framework database migration on CE instances
merge_request: 46761
author:
type: fixed
...@@ -52,8 +52,6 @@ class MigrateComplianceFrameworkEnumToDatabaseFrameworkRecord < ActiveRecord::Mi ...@@ -52,8 +52,6 @@ class MigrateComplianceFrameworkEnumToDatabaseFrameworkRecord < ActiveRecord::Mi
end end
def up def up
return unless Gitlab.ee?
TmpComplianceFramework.reset_column_information TmpComplianceFramework.reset_column_information
TmpProjectSettings.reset_column_information TmpProjectSettings.reset_column_information
......
...@@ -30,41 +30,23 @@ RSpec.describe MigrateComplianceFrameworkEnumToDatabaseFrameworkRecord, schema: ...@@ -30,41 +30,23 @@ RSpec.describe MigrateComplianceFrameworkEnumToDatabaseFrameworkRecord, schema:
subject { described_class.new.up } subject { described_class.new.up }
context 'when Gitlab.ee? is true' do it 'updates the project settings' do
before do subject
expect(Gitlab).to receive(:ee?).and_return(true)
end
it 'updates the project settings' do gdpr_framework = compliance_management_frameworks.find_by(namespace_id: root_group.id, name: 'GDPR')
subject expect(project_on_root_level_compliance_setting.reload.framework_id).to eq(gdpr_framework.id)
expect(project_on_sub_sub_level_compliance_setting_2.reload.framework_id).to eq(gdpr_framework.id)
gdpr_framework = compliance_management_frameworks.find_by(namespace_id: root_group.id, name: 'GDPR') sox_framework = compliance_management_frameworks.find_by(namespace_id: root_group.id, name: 'SOX')
expect(project_on_root_level_compliance_setting.reload.framework_id).to eq(gdpr_framework.id) expect(project_on_sub_sub_level_compliance_setting_1.reload.framework_id).to eq(sox_framework.id)
expect(project_on_sub_sub_level_compliance_setting_2.reload.framework_id).to eq(gdpr_framework.id)
sox_framework = compliance_management_frameworks.find_by(namespace_id: root_group.id, name: 'SOX') gdpr_framework = compliance_management_frameworks.find_by(namespace_id: namespace.id, name: 'GDPR')
expect(project_on_sub_sub_level_compliance_setting_1.reload.framework_id).to eq(sox_framework.id) expect(project_on_namespace_level_compliance_setting.reload.framework_id).to eq(gdpr_framework.id)
gdpr_framework = compliance_management_frameworks.find_by(namespace_id: namespace.id, name: 'GDPR')
expect(project_on_namespace_level_compliance_setting.reload.framework_id).to eq(gdpr_framework.id)
end
it 'adds two framework records' do
subject
expect(compliance_management_frameworks.count).to eq(3)
end
end end
context 'when Gitlab.ee? is false' do it 'adds two framework records' do
before do subject
expect(Gitlab).to receive(:ee?).and_return(false)
end
it 'does nothing' do
subject
expect(compliance_management_frameworks.count).to eq(0) expect(compliance_management_frameworks.count).to eq(3)
end
end end
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