Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1e4c07a6
Commit
1e4c07a6
authored
Nov 13, 2020
by
Terri Chu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change ElasticDeleteProjectWorker to delete by project_id
parent
00d3a4eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
ee/app/workers/elastic_delete_project_worker.rb
ee/app/workers/elastic_delete_project_worker.rb
+8
-6
ee/spec/workers/elastic_delete_project_worker_spec.rb
ee/spec/workers/elastic_delete_project_worker_spec.rb
+8
-1
No files found.
ee/app/workers/elastic_delete_project_worker.rb
View file @
1e4c07a6
...
@@ -25,16 +25,18 @@ class ElasticDeleteProjectWorker
...
@@ -25,16 +25,18 @@ class ElasticDeleteProjectWorker
bool:
{
bool:
{
should:
[
should:
[
{
{
has_parent:
{
term:
{
parent_type:
'project'
,
_id:
es_id
query:
{
term:
{
id:
project_id
}
}
}
},
{
term:
{
project_id:
project_id
}
}
},
},
{
{
term:
{
term:
{
_id:
es
_id
target_project_id:
project_id
# handle merge_request which aliases project_id to target_project
_id
}
}
}
}
]
]
...
...
ee/spec/workers/elastic_delete_project_worker_spec.rb
View file @
1e4c07a6
...
@@ -14,7 +14,7 @@ RSpec.describe ElasticDeleteProjectWorker, :elastic do
...
@@ -14,7 +14,7 @@ RSpec.describe ElasticDeleteProjectWorker, :elastic do
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
end
end
it
'deletes a project with all nested objects'
do
it
'deletes a project with all nested objects'
,
:aggregate_failures
do
project
=
create
:project
,
:repository
project
=
create
:project
,
:repository
issue
=
create
:issue
,
project:
project
issue
=
create
:issue
,
project:
project
milestone
=
create
:milestone
,
project:
project
milestone
=
create
:milestone
,
project:
project
...
@@ -38,5 +38,12 @@ RSpec.describe ElasticDeleteProjectWorker, :elastic do
...
@@ -38,5 +38,12 @@ RSpec.describe ElasticDeleteProjectWorker, :elastic do
expect
(
Milestone
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
expect
(
Milestone
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
expect
(
Note
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
expect
(
Note
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
expect
(
MergeRequest
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
expect
(
MergeRequest
.
elastic_search
(
'*'
,
**
search_options
).
total_count
).
to
be
(
0
)
# verify that entire index is empty
# searches use joins on the parent record (project)
# and the previous queries will not find data left in the index
helper
=
Gitlab
::
Elastic
::
Helper
.
default
expect
(
helper
.
documents_count
).
to
be
(
0
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment