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.
This commit is contained in:
parent
280ac894d2
commit
c0a812ecb7
3 changed files with 3 additions and 3 deletions
|
@ -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
|
||||||
# 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
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue