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
6deb952e
Commit
6deb952e
authored
Aug 15, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run Sidekiq in inline mode for Elastic Search related specs
parent
cf1076a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
51 deletions
+71
-51
spec/models/concerns/elastic/issue_spec.rb
spec/models/concerns/elastic/issue_spec.rb
+8
-6
spec/models/concerns/elastic/milestone_spec.rb
spec/models/concerns/elastic/milestone_spec.rb
+8
-6
spec/models/concerns/elastic/note_spec.rb
spec/models/concerns/elastic/note_spec.rb
+28
-21
spec/models/concerns/elastic/project_spec.rb
spec/models/concerns/elastic/project_spec.rb
+10
-6
spec/models/concerns/elastic/repositories_spec.rb
spec/models/concerns/elastic/repositories_spec.rb
+5
-3
spec/models/concerns/elastic/snippet_spec.rb
spec/models/concerns/elastic/snippet_spec.rb
+7
-5
spec/models/concerns/elastic/wiki_repositories_spec.rb
spec/models/concerns/elastic/wiki_repositories_spec.rb
+5
-4
No files found.
spec/models/concerns/elastic/issue_spec.rb
View file @
6deb952e
...
...
@@ -14,14 +14,16 @@ describe Issue, elastic: true do
it
"searches issues"
do
project
=
create
:empty_project
create
:issue
,
title:
'bla-bla term'
,
project:
project
create
:issue
,
description:
'bla-bla term'
,
project:
project
create
:issue
,
project:
project
Sidekiq
::
Testing
.
inline!
do
create
:issue
,
title:
'bla-bla term'
,
project:
project
create
:issue
,
description:
'bla-bla term'
,
project:
project
create
:issue
,
project:
project
# The issue I have no access to
create
:issue
,
title:
'bla-bla term'
# The issue I have no access to
create
:issue
,
title:
'bla-bla term'
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
project
.
id
]
}
...
...
spec/models/concerns/elastic/milestone_spec.rb
View file @
6deb952e
...
...
@@ -14,14 +14,16 @@ describe Milestone, elastic: true do
it
"searches milestones"
do
project
=
create
:empty_project
create
:milestone
,
title:
'bla-bla term'
,
project:
project
create
:milestone
,
description:
'bla-bla term'
,
project:
project
create
:milestone
,
project:
project
Sidekiq
::
Testing
.
inline!
do
create
:milestone
,
title:
'bla-bla term'
,
project:
project
create
:milestone
,
description:
'bla-bla term'
,
project:
project
create
:milestone
,
project:
project
# The milestone you have no access to
create
:milestone
,
title:
'bla-bla term'
# The milestone you have no access to
create
:milestone
,
title:
'bla-bla term'
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
project
.
id
]
}
...
...
spec/models/concerns/elastic/note_spec.rb
View file @
6deb952e
...
...
@@ -14,13 +14,15 @@ describe Note, elastic: true do
it
"searches notes"
do
issue
=
create
:issue
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
create
:note
,
project:
issue
.
project
Sidekiq
::
Testing
.
inline!
do
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
create
:note
,
project:
issue
.
project
# The note in the project you have no access to
create
:note
,
note:
'bla-bla term'
# The note in the project you have no access to
create
:note
,
note:
'bla-bla term'
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
issue
.
project
.
id
]
}
...
...
@@ -56,10 +58,10 @@ describe Note, elastic: true do
it
"does not find note"
do
issue
=
create
:issue
,
:confidential
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
,
noteable:
issue
create
:note
,
project:
issue
.
project
,
noteable:
issue
Gitlab
::
Elastic
::
Helper
.
refresh_index
Sidekiq
::
Testing
.
inline!
do
create_notes_for
(
issue
,
'bla-bla term'
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
issue
.
project
.
id
]
}
...
...
@@ -70,10 +72,10 @@ describe Note, elastic: true do
user
=
create
:user
issue
=
create
:issue
,
:confidential
,
author:
user
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
,
noteable:
issue
create
:note
,
project:
issue
.
project
,
noteable:
issue
Gitlab
::
Elastic
::
Helper
.
refresh_index
Sidekiq
::
Testing
.
inline!
do
create_notes_for
(
issue
,
'bla-bla term'
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
issue
.
project
.
id
],
current_user:
user
}
...
...
@@ -87,10 +89,10 @@ describe Note, elastic: true do
member
=
create
(
:user
)
issue
.
project
.
team
<<
[
member
,
:developer
]
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
,
noteable:
issue
create
:note
,
project:
issue
.
project
,
noteable:
issue
Gitlab
::
Elastic
::
Helper
.
refresh_index
Sidekiq
::
Testing
.
inline!
do
create_notes_for
(
issue
,
'bla-bla term'
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
issue
.
project
.
id
],
current_user:
member
}
...
...
@@ -104,14 +106,19 @@ describe Note, elastic: true do
member
=
create
(
:user
)
issue
.
project
.
team
<<
[
member
,
:guest
]
create
:note
,
note:
'bla-bla term'
,
project:
issue
.
project
,
noteable:
issue
create
:note
,
project:
issue
.
project
,
noteable:
issue
Gitlab
::
Elastic
::
Helper
.
refresh_index
Sidekiq
::
Testing
.
inline!
do
create_notes_for
(
issue
,
'bla-bla term'
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
issue
.
project
.
id
],
current_user:
member
}
expect
(
Note
.
elastic_search
(
'term'
,
options:
options
).
total_count
).
to
eq
(
0
)
end
end
def
create_notes_for
(
issue
,
note
)
create
:note
,
note:
note
,
project:
issue
.
project
,
noteable:
issue
create
:note
,
project:
issue
.
project
,
noteable:
issue
end
end
spec/models/concerns/elastic/project_spec.rb
View file @
6deb952e
...
...
@@ -12,13 +12,17 @@ describe Project, elastic: true do
end
it
"searches projects"
do
project
=
create
:empty_project
,
name:
'test'
project1
=
create
:empty_project
,
path:
'test1'
project2
=
create
:empty_project
create
:empty_project
,
path:
'someone_elses_project'
project_ids
=
[
project
.
id
,
project1
.
id
,
project2
.
id
]
project_ids
=
[]
Gitlab
::
Elastic
::
Helper
.
refresh_index
Sidekiq
::
Testing
.
inline!
do
project
=
create
:empty_project
,
name:
'test'
project1
=
create
:empty_project
,
path:
'test1'
project2
=
create
:empty_project
create
:empty_project
,
path:
'someone_elses_project'
project_ids
+=
[
project
.
id
,
project1
.
id
,
project2
.
id
]
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
expect
(
described_class
.
elastic_search
(
'test'
,
options:
{
pids:
project_ids
}).
total_count
).
to
eq
(
1
)
expect
(
described_class
.
elastic_search
(
'test1'
,
options:
{
pids:
project_ids
}).
total_count
).
to
eq
(
1
)
...
...
spec/models/concerns/elastic/repositories_spec.rb
View file @
6deb952e
...
...
@@ -14,10 +14,12 @@ describe Repository, elastic: true do
it
"searches blobs and commits"
do
project
=
create
:project
project
.
repository
.
index_blobs
project
.
repository
.
index_commits
Sidekiq
::
Testing
.
inline!
do
project
.
repository
.
index_blobs
project
.
repository
.
index_commits
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
expect
(
project
.
repository
.
search
(
'def popen'
)[
:blobs
][
:total_count
]).
to
eq
(
1
)
expect
(
project
.
repository
.
search
(
'initial'
)[
:commits
][
:total_count
]).
to
eq
(
1
)
...
...
spec/models/concerns/elastic/snippet_spec.rb
View file @
6deb952e
...
...
@@ -73,12 +73,14 @@ describe Snippet, elastic: true do
it
'searches snippets by title and file_name'
do
user
=
create
(
:user
)
create
(
:snippet
,
:public
,
title:
'home'
)
create
(
:snippet
,
:private
,
title:
'home 1'
)
create
(
:snippet
,
:public
,
file_name:
'index.php'
)
create
(
:snippet
)
Sidekiq
::
Testing
.
inline!
do
create
(
:snippet
,
:public
,
title:
'home'
)
create
(
:snippet
,
:private
,
title:
'home 1'
)
create
(
:snippet
,
:public
,
file_name:
'index.php'
)
create
(
:snippet
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
user:
user
}
...
...
spec/models/concerns/elastic/wiki_repos
o
tories_spec.rb
→
spec/models/concerns/elastic/wiki_repos
i
tories_spec.rb
View file @
6deb952e
...
...
@@ -14,11 +14,12 @@ describe ProjectWiki, elastic: true do
it
"searches wiki page"
do
project
=
create
:empty_project
project
.
wiki
.
create_page
(
"index_page"
,
"Bla bla"
)
Sidekiq
::
Testing
.
inline!
do
project
.
wiki
.
create_page
(
"index_page"
,
"Bla bla"
)
project
.
wiki
.
index_blobs
project
.
wiki
.
index_blobs
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
expect
(
project
.
wiki
.
search
(
'bla'
,
type: :blob
)[
:blobs
][
:total_count
]).
to
eq
(
1
)
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