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
8756cf51
Commit
8756cf51
authored
Jul 08, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the en/dis-ablement of the ES feature in a flaky test
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
50967e64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
26 deletions
+33
-26
ee/spec/workers/elastic_namespace_indexer_worker_spec.rb
ee/spec/workers/elastic_namespace_indexer_worker_spec.rb
+33
-26
No files found.
ee/spec/workers/elastic_namespace_indexer_worker_spec.rb
View file @
8756cf51
...
...
@@ -2,45 +2,52 @@
require
'spec_helper'
RSpec
.
describe
ElasticNamespaceIndexerWorker
,
:elastic
do
RSpec
.
describe
ElasticNamespaceIndexerWorker
do
subject
{
described_class
.
new
}
before
do
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
stub_ee_application_setting
(
elasticsearch_limit_indexing:
true
)
end
it
'returns true if ES disabled'
do
stub_ee_application_setting
(
elasticsearch_indexing:
false
)
context
'when ES is disabled'
do
before
do
stub_ee_application_setting
(
elasticsearch_indexing:
false
)
stub_ee_application_setting
(
elasticsearch_limit_indexing:
false
)
end
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
not_to
receive
(
:backfill_projects!
)
it
'returns true'
do
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
not_to
receive
(
:backfill_projects!
)
expect
(
subject
.
perform
(
1
,
"index"
)).
to
be_truthy
expect
(
subject
.
perform
(
1
,
"index"
)).
to
be_truthy
end
end
it
'returns true if limited indexing is not enabled'
do
stub_ee_application_setting
(
elasticsearch_limit_indexing:
false
)
context
'when ES is enabled'
,
:elastic
do
before
do
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
stub_ee_application_setting
(
elasticsearch_limit_indexing:
true
)
end
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
not_to
receive
(
:backfill_projects!
)
it
'returns true if limited indexing is not enabled'
do
stub_ee_application_setting
(
elasticsearch_limit_indexing:
false
)
expect
(
subject
.
perform
(
1
,
"index"
)).
to
be_truthy
end
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
not_to
receive
(
:backfill_projects!
)
expect
(
subject
.
perform
(
1
,
"index"
)).
to
be_truthy
end
describe
'indexing and deleting'
do
let_it_be
(
:namespace
)
{
create
:namespace
}
let
(
:projects
)
{
create_list
:project
,
3
,
namespace:
namespace
}
describe
'indexing and deleting'
do
let_it_be
(
:namespace
)
{
create
:namespace
}
let
(
:projects
)
{
create_list
:project
,
3
,
namespace:
namespace
}
it
'indexes all projects belonging to the namespace'
do
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
to
receive
(
:backfill_projects!
).
with
(
*
projects
)
it
'indexes all projects belonging to the namespace'
do
expect
(
Elastic
::
ProcessInitialBookkeepingService
).
to
receive
(
:backfill_projects!
).
with
(
*
projects
)
subject
.
perform
(
namespace
.
id
,
:index
)
end
subject
.
perform
(
namespace
.
id
,
:index
)
end
it
'deletes all projects belonging to the namespace'
do
args
=
projects
.
map
{
|
project
|
[
project
.
id
,
project
.
es_id
]
}
expect
(
ElasticDeleteProjectWorker
).
to
receive
(
:bulk_perform_async
).
with
(
args
)
it
'deletes all projects belonging to the namespace'
do
args
=
projects
.
map
{
|
project
|
[
project
.
id
,
project
.
es_id
]
}
expect
(
ElasticDeleteProjectWorker
).
to
receive
(
:bulk_perform_async
).
with
(
args
)
subject
.
perform
(
namespace
.
id
,
:delete
)
subject
.
perform
(
namespace
.
id
,
:delete
)
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