diff options
author | Toon Claes <toon@iotcl.com> | 2017-08-16 14:46:26 +0200 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-08-22 14:29:54 +0200 |
commit | 2074f39a47645b5ea453adfba84247f2fcc4f3c7 (patch) | |
tree | 3f2aab56177cf0704faa8d739ce61acc7055a99e /spec/workers | |
parent | ce89c425fe51d2317322350bbd8a364c08d97d21 (diff) | |
download | gitlab-ce-2074f39a47645b5ea453adfba84247f2fcc4f3c7.tar.gz |
Migration to remove pending delete projects with non-existing namespace
There might be some projects where the namespace was removed, but the
project wasn't. For these the projects still have a `namespace_id`
set. So this adds a post-deploy migration remove all projects that are
pending delete, and have a `namespace_id` that is non-existing.
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/namespaceless_project_destroy_worker_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/workers/namespaceless_project_destroy_worker_spec.rb b/spec/workers/namespaceless_project_destroy_worker_spec.rb index 817e103fd9a..20cf580af8a 100644 --- a/spec/workers/namespaceless_project_destroy_worker_spec.rb +++ b/spec/workers/namespaceless_project_destroy_worker_spec.rb @@ -75,5 +75,19 @@ describe NamespacelessProjectDestroyWorker do end end end + + context 'project has non-existing namespace' do + let!(:project) do + project = build(:project, namespace_id: Namespace.maximum(:id).to_i.succ) + project.save(validate: false) + project + end + + it 'deletes the project' do + subject.perform(project.id) + + expect(Project.unscoped.all).not_to include(project) + end + end end end |