summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-08 17:12:29 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-08 17:12:29 +0200
commit8624a4eddec214a4092c34202bfc0cc92e72eb19 (patch)
tree904bef4d8fa6820953fb02c56a364a4866520277 /spec
parentd8d0067bf5afd555f80e55e0bed20c4161b0a7ee (diff)
downloadgitlab-ce-8624a4eddec214a4092c34202bfc0cc92e72eb19.tar.gz
Remove orphaned builds without project / pipeline reference
Diffstat (limited to 'spec')
-rw-r--r--spec/migrations/add_pipeline_build_foreign_key_spec.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/migrations/add_pipeline_build_foreign_key_spec.rb b/spec/migrations/add_pipeline_build_foreign_key_spec.rb
index 7358b1d265d..e9413f52f19 100644
--- a/spec/migrations/add_pipeline_build_foreign_key_spec.rb
+++ b/spec/migrations/add_pipeline_build_foreign_key_spec.rb
@@ -16,10 +16,12 @@ describe AddPipelineBuildForeignKey, :migration do
builds.create!(id: 102, commit_id: 222, project_id: 11)
builds.create!(id: 103, commit_id: 333, project_id: 11)
builds.create!(id: 104, commit_id: 12, project_id: 11)
+ builds.create!(id: 106, commit_id: nil, project_id: 11)
+ builds.create!(id: 107, commit_id: 12, project_id: nil)
end
it 'adds foreign key after removing orphans' do
- expect(builds.all.count).to eq 4
+ expect(builds.all.count).to eq 6
expect(foreign_key_exists?(:ci_builds, :ci_pipelines, column: :commit_id)).to be_falsey
migrate!