Commit c0a812ec authored by Krasimir Angelov's avatar Krasimir Angelov

Fix migration specs using factories

We need to stub default_git_depth and default_git_depth= because some
old migrations specs try to create a record using schema before that
column was introduced.
parent 280ac894
...@@ -5,7 +5,7 @@ describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, :sidekiq, sch ...@@ -5,7 +5,7 @@ describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, :sidekiq, sch
describe '#perform' do describe '#perform' do
before do before do
# This migration was created before we introduced ProjectCiCdSetting#default_git_depth # This migration was created before we introduced ProjectCiCdSetting#default_git_depth
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0)
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil)
end end
......
...@@ -10,8 +10,8 @@ describe Gitlab::BackgroundMigration::PopulateExternalPipelineSource, :migration ...@@ -10,8 +10,8 @@ describe Gitlab::BackgroundMigration::PopulateExternalPipelineSource, :migration
# This migration was created before we introduced metadata configs # This migration was created before we introduced metadata configs
stub_feature_flags(ci_build_metadata_config: false) stub_feature_flags(ci_build_metadata_config: false)
# This migration was created before we introduced ProjectCiCdSetting#default_git_depth # This migration was created before we introduced ProjectCiCdSetting#default_git_depth
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true)
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil)
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0)
end end
let!(:internal_pipeline) { create(:ci_pipeline, source: :web) } let!(:internal_pipeline) { create(:ci_pipeline, source: :web) }
......
...@@ -12,8 +12,8 @@ describe RemoveOrphanedLabelLinks, :migration do ...@@ -12,8 +12,8 @@ describe RemoveOrphanedLabelLinks, :migration do
before do before do
# This migration was created before we introduced ProjectCiCdSetting#default_git_depth # This migration was created before we introduced ProjectCiCdSetting#default_git_depth
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true)
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil)
allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0)
end end
context 'add foreign key on label_id' do context 'add foreign key on label_id' do
......
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