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
10d9c574
Commit
10d9c574
authored
Aug 23, 2021
by
Erick Banks
Committed by
Ramya Authappan
Aug 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for each individual search index
parent
1dae49eb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
215 additions
and
3 deletions
+215
-3
qa/qa/resource/issue.rb
qa/qa/resource/issue.rb
+5
-2
qa/qa/runtime/search.rb
qa/qa/runtime/search.rb
+5
-1
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/issues_index/issue_index_spec.rb
...lasticsearch/index_tests/issues_index/issue_index_spec.rb
+47
-0
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/main_index/blob_index_spec.rb
...t/elasticsearch/index_tests/main_index/blob_index_spec.rb
+55
-0
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/merge_request_index/merge_request_index_spec.rb
...dex_tests/merge_request_index/merge_request_index_spec.rb
+47
-0
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/notes_index/note_index_spec.rb
.../elasticsearch/index_tests/notes_index/note_index_spec.rb
+54
-0
qa/qa/specs/features/ee/browser_ui/2_plan/issue/default_issue_template_spec.rb
...ee/browser_ui/2_plan/issue/default_issue_template_spec.rb
+2
-0
No files found.
qa/qa/resource/issue.rb
View file @
10d9c574
...
...
@@ -18,12 +18,14 @@ module QA
:iid
,
:assignee_ids
,
:labels
,
:title
:title
,
:description
def
initialize
@assignee_ids
=
[]
@labels
=
[]
@title
=
"Issue title
#{
SecureRandom
.
hex
(
8
)
}
"
@description
=
"Issue description
#{
SecureRandom
.
hex
(
8
)
}
"
end
def
fabricate!
...
...
@@ -34,7 +36,7 @@ module QA
Page
::
Project
::
Issue
::
New
.
perform
do
|
new_page
|
new_page
.
fill_title
(
@title
)
new_page
.
choose_template
(
@template
)
if
@template
new_page
.
fill_description
(
@description
)
if
@description
new_page
.
fill_description
(
@description
)
if
@description
&&
!
@template
new_page
.
choose_milestone
(
@milestone
)
if
@milestone
new_page
.
create_new_issue
end
...
...
@@ -64,6 +66,7 @@ module QA
}.
tap
do
|
hash
|
hash
[
:milestone_id
]
=
@milestone
.
id
if
@milestone
hash
[
:weight
]
=
@weight
if
@weight
hash
[
:description
]
=
@description
if
@description
end
end
...
...
qa/qa/runtime/search.rb
View file @
10d9c574
...
...
@@ -8,6 +8,10 @@ module QA
extend
self
extend
Support
::
Api
RETRY_MAX_ITERATION
=
10
RETRY_SLEEP_INTERVAL
=
12
INSERT_RECALL_THRESHOLD
=
RETRY_MAX_ITERATION
*
RETRY_SLEEP_INTERVAL
ElasticSearchServerError
=
Class
.
new
(
RuntimeError
)
def
assert_elasticsearch_responding
...
...
@@ -85,7 +89,7 @@ module QA
private
def
find_target_in_scope
(
scope
,
search_term
)
QA
::
Support
::
Retrier
.
retry_until
(
max_attempts:
10
,
sleep_interval:
10
,
raise_on_failure:
true
,
retry_on_exception:
true
)
do
QA
::
Support
::
Retrier
.
retry_until
(
max_attempts:
RETRY_MAX_ITERATION
,
sleep_interval:
RETRY_SLEEP_INTERVAL
,
raise_on_failure:
true
,
retry_on_exception:
true
)
do
result
=
search
(
scope
,
search_term
)
result
&&
result
.
any?
{
|
record
|
yield
record
}
end
...
...
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/issues_index/issue_index_spec.rb
0 → 100644
View file @
10d9c574
# frozen_string_literal: true
require
'airborne'
require
'securerandom'
module
QA
RSpec
.
describe
'Enablement:Search'
do
describe
'When using elasticsearch API to search for a public issue'
,
:orchestrated
,
:elasticsearch
do
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:issue
)
do
Resource
::
Issue
.
fabricate_via_api!
do
|
issue
|
issue
.
title
=
'Issue for issue index test'
issue
.
description
=
"Some issue description
#{
SecureRandom
.
hex
(
8
)
}
"
end
end
let
(
:elasticsearch_original_state_on?
)
{
Runtime
::
Search
.
elasticsearch_on?
(
api_client
)
}
before
do
unless
elasticsearch_original_state_on?
QA
::
EE
::
Resource
::
Settings
::
Elasticsearch
.
fabricate_via_api!
end
end
after
do
if
!
elasticsearch_original_state_on?
&&
!
api_client
.
nil?
Runtime
::
Search
.
disable_elasticsearch
(
api_client
)
end
issue
.
project
.
remove_via_api!
end
it
'finds issue that matches description'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1870'
do
QA
::
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
Runtime
::
Search
::
RETRY_MAX_ITERATION
,
sleep_interval:
Runtime
::
Search
::
RETRY_SLEEP_INTERVAL
)
do
get
Runtime
::
Search
.
create_search_request
(
api_client
,
'issues'
,
issue
.
description
).
url
expect_status
(
QA
::
Support
::
Api
::
HTTP_STATUS_OK
)
raise
'Empty search result returned'
if
json_body
.
empty?
expect
(
json_body
[
0
][
:description
]).
to
eq
(
issue
.
description
)
expect
(
json_body
[
0
][
:project_id
]).
to
equal
(
issue
.
project
.
id
)
end
end
end
end
end
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/main_index/blob_index_spec.rb
0 → 100644
View file @
10d9c574
# frozen_string_literal: true
require
'airborne'
require
'securerandom'
module
QA
RSpec
.
describe
'Enablement:Search'
do
describe
'When using elasticsearch API to search for a public blob'
,
:orchestrated
,
:elasticsearch
do
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
"test-project-for-blob-index"
end
end
let
(
:project_file_content
)
{
"File content for blob index test
#{
SecureRandom
.
hex
(
8
)
}
"
}
let
(
:elasticsearch_original_state_on?
)
{
Runtime
::
Search
.
elasticsearch_on?
(
api_client
)
}
before
do
unless
elasticsearch_original_state_on?
QA
::
EE
::
Resource
::
Settings
::
Elasticsearch
.
fabricate_via_api!
end
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
add_files
([
{
file_path:
'README.md'
,
content:
project_file_content
}
])
end
end
after
do
if
!
elasticsearch_original_state_on?
&&
!
api_client
.
nil?
Runtime
::
Search
.
disable_elasticsearch
(
api_client
)
end
project
.
remove_via_api!
end
it
'finds blob that matches file content'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1869'
do
QA
::
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
Runtime
::
Search
::
RETRY_MAX_ITERATION
,
sleep_interval:
Runtime
::
Search
::
RETRY_SLEEP_INTERVAL
)
do
get
Runtime
::
Search
.
create_search_request
(
api_client
,
'blobs'
,
project_file_content
).
url
expect_status
(
QA
::
Support
::
Api
::
HTTP_STATUS_OK
)
raise
'Empty search result returned'
if
json_body
.
empty?
expect
(
json_body
[
0
][
:data
]).
to
match
(
project_file_content
)
expect
(
json_body
[
0
][
:project_id
]).
to
equal
(
project
.
id
)
end
end
end
end
end
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/merge_request_index/merge_request_index_spec.rb
0 → 100644
View file @
10d9c574
# frozen_string_literal: true
require
'airborne'
require
'securerandom'
module
QA
RSpec
.
describe
'Enablement:Search'
do
describe
'When using elasticsearch API to search for a public merge request'
,
:orchestrated
,
:elasticsearch
do
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:merge_request
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
mr
|
mr
.
title
=
'Merge request for merge request index test'
mr
.
description
=
"Some merge request description
#{
SecureRandom
.
hex
(
8
)
}
"
end
end
let
(
:elasticsearch_original_state_on?
)
{
Runtime
::
Search
.
elasticsearch_on?
(
api_client
)
}
before
do
unless
elasticsearch_original_state_on?
QA
::
EE
::
Resource
::
Settings
::
Elasticsearch
.
fabricate_via_api!
end
end
after
do
if
!
elasticsearch_original_state_on?
&&
!
api_client
.
nil?
Runtime
::
Search
.
disable_elasticsearch
(
api_client
)
end
merge_request
.
project
.
remove_via_api!
end
it
'finds merge request that matches description'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1867'
do
QA
::
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
Runtime
::
Search
::
RETRY_MAX_ITERATION
,
sleep_interval:
Runtime
::
Search
::
RETRY_SLEEP_INTERVAL
)
do
get
Runtime
::
Search
.
create_search_request
(
api_client
,
'merge_requests'
,
merge_request
.
description
).
url
expect_status
(
QA
::
Support
::
Api
::
HTTP_STATUS_OK
)
raise
'Empty search result returned'
if
json_body
.
empty?
expect
(
json_body
[
0
][
:description
]).
to
eq
(
merge_request
.
description
)
expect
(
json_body
[
0
][
:project_id
]).
to
eq
(
merge_request
.
project
.
id
)
end
end
end
end
end
qa/qa/specs/features/ee/api/enablement/elasticsearch/index_tests/notes_index/note_index_spec.rb
0 → 100644
View file @
10d9c574
# frozen_string_literal: true
require
'airborne'
require
'securerandom'
module
QA
RSpec
.
describe
'Enablement:Search'
do
describe
'When using elasticsearch API to search for a public note'
,
:orchestrated
,
:elasticsearch
do
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:issue
)
do
Resource
::
Issue
.
fabricate_via_api!
do
|
issue
|
issue
.
title
=
'Issue for note index test'
end
end
let
(
:note
)
do
Resource
::
ProjectIssueNote
.
fabricate_via_api!
do
|
project_issue_note
|
project_issue_note
.
project
=
issue
.
project
project_issue_note
.
issue
=
issue
project_issue_note
.
body
=
"This is a comment with a unique number
#{
SecureRandom
.
hex
(
8
)
}
"
end
end
let
(
:elasticsearch_original_state_on?
)
{
Runtime
::
Search
.
elasticsearch_on?
(
api_client
)
}
before
do
unless
elasticsearch_original_state_on?
QA
::
EE
::
Resource
::
Settings
::
Elasticsearch
.
fabricate_via_api!
end
end
after
do
if
!
elasticsearch_original_state_on?
&&
!
api_client
.
nil?
Runtime
::
Search
.
disable_elasticsearch
(
api_client
)
end
issue
.
project
.
remove_via_api!
end
it
'finds note that matches note body'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1868'
do
QA
::
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
Runtime
::
Search
::
RETRY_MAX_ITERATION
,
sleep_interval:
Runtime
::
Search
::
RETRY_SLEEP_INTERVAL
)
do
get
Runtime
::
Search
.
create_search_request
(
api_client
,
'notes'
,
note
.
body
).
url
expect_status
(
QA
::
Support
::
Api
::
HTTP_STATUS_OK
)
raise
'Empty search result returned'
if
json_body
.
empty?
expect
(
json_body
[
0
][
:body
]).
to
eq
(
note
.
body
)
expect
(
json_body
[
0
][
:noteable_id
]).
to
eq
(
issue
.
id
)
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/2_plan/issue/default_issue_template_spec.rb
View file @
10d9c574
...
...
@@ -25,6 +25,8 @@ module QA
end
Resource
::
Issue
.
fabricate_via_api!
do
|
issue
|
# Clears default description so as not to overwrite default template
issue
.
description
=
nil
issue
.
project
=
default_template_project
end
.
visit!
...
...
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