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
c1d3b27d
Commit
c1d3b27d
authored
Nov 19, 2020
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge 2 different elastic rake spec files
parent
61f92c32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
40 deletions
+31
-40
ee/spec/tasks/elastic_rake_spec.rb
ee/spec/tasks/elastic_rake_spec.rb
+0
-40
ee/spec/tasks/gitlab/elastic_rake_spec.rb
ee/spec/tasks/gitlab/elastic_rake_spec.rb
+31
-0
No files found.
ee/spec/tasks/elastic_rake_spec.rb
deleted
100644 → 0
View file @
61f92c32
# frozen_string_literal: true
require
'rake_helper'
RSpec
.
describe
'elastic rake tasks'
,
:elastic
do
before
do
Rake
.
application
.
rake_require
'tasks/gitlab/elastic'
end
describe
'create_empty_index'
do
subject
{
run_rake_task
(
'gitlab:elastic:create_empty_index'
)
}
before
do
es_helper
.
delete_index
end
it
'creates an index'
do
expect
{
subject
}.
to
change
{
es_helper
.
index_exists?
}.
from
(
false
).
to
(
true
)
end
it
'marks all migrations as completed'
do
expect
(
Elastic
::
DataMigrationService
).
to
receive
(
:mark_all_as_completed!
).
and_call_original
expect
(
Elastic
::
MigrationRecord
.
persisted_versions
(
completed:
true
)).
to
eq
([])
subject
refresh_index!
migrations
=
Elastic
::
DataMigrationService
.
migrations
.
map
(
&
:version
)
expect
(
Elastic
::
MigrationRecord
.
persisted_versions
(
completed:
true
)).
to
eq
(
migrations
)
end
end
describe
'delete_index'
do
subject
{
run_rake_task
(
'gitlab:elastic:delete_index'
)
}
it
'removes the index'
do
expect
{
subject
}.
to
change
{
es_helper
.
index_exists?
}.
from
(
true
).
to
(
false
)
end
end
end
ee/spec/tasks/gitlab/elastic_rake_spec.rb
View file @
c1d3b27d
...
...
@@ -7,6 +7,37 @@ RSpec.describe 'gitlab:elastic namespace rake tasks', :elastic do
Rake
.
application
.
rake_require
'tasks/gitlab/elastic'
end
describe
'create_empty_index'
do
subject
{
run_rake_task
(
'gitlab:elastic:create_empty_index'
)
}
before
do
es_helper
.
delete_index
end
it
'creates an index'
do
expect
{
subject
}.
to
change
{
es_helper
.
index_exists?
}.
from
(
false
).
to
(
true
)
end
it
'marks all migrations as completed'
do
expect
(
Elastic
::
DataMigrationService
).
to
receive
(
:mark_all_as_completed!
).
and_call_original
expect
(
Elastic
::
MigrationRecord
.
persisted_versions
(
completed:
true
)).
to
eq
([])
subject
refresh_index!
migrations
=
Elastic
::
DataMigrationService
.
migrations
.
map
(
&
:version
)
expect
(
Elastic
::
MigrationRecord
.
persisted_versions
(
completed:
true
)).
to
eq
(
migrations
)
end
end
describe
'delete_index'
do
subject
{
run_rake_task
(
'gitlab:elastic:delete_index'
)
}
it
'removes the index'
do
expect
{
subject
}.
to
change
{
es_helper
.
index_exists?
}.
from
(
true
).
to
(
false
)
end
end
context
"with elasticsearch_indexing enabled"
do
before
do
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
...
...
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