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
dbdf21ca
Commit
dbdf21ca
authored
Nov 17, 2020
by
Erick Banks
Committed by
Mark Lapierre
Nov 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New blackbox elasticsearch approach
parent
27b3aaa9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
qa/qa/specs/features/ee/api/enablement/elasticsearch/nightly_elasticsearch_test_spec.rb
...ablement/elasticsearch/nightly_elasticsearch_test_spec.rb
+67
-0
No files found.
qa/qa/specs/features/ee/api/enablement/elasticsearch/nightly_elasticsearch_test_spec.rb
0 → 100644
View file @
dbdf21ca
# frozen_string_literal: true
require
'airborne'
require
'securerandom'
module
QA
RSpec
.
describe
'Enablement:Search'
do
describe
'When using elasticsearch API to search for a known blob'
,
:orchestrated
,
:elasticsearch
,
:requires_admin
,
only:
{
pipeline: :nightly
}
do
p1_threshold
=
15
p2_threshold
=
10
p3_threshold
=
5
p4_threshold
=
3
let
(
:project_file_content
)
{
"elasticsearch:
#{
SecureRandom
.
hex
(
8
)
}
"
}
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
"api-es-
#{
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
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
end
it
'searches public project and finds a blob as an non-member user'
do
start_time
=
Time
.
now
while
(
Time
.
now
-
start_time
)
/
60
<
p1_threshold
get
Runtime
::
Search
.
create_search_request
(
api_client
,
'blobs'
,
project_file_content
).
url
expect_status
(
QA
::
Support
::
Api
::
HTTP_STATUS_OK
)
if
!
json_body
.
empty?
&&
json_body
[
0
][
:data
].
match
(
project_file_content
)
&&
json_body
[
0
][
:project_id
].
equal?
(
project
.
id
)
break
end
sleep
10
end
time_elapsed
=
(
Time
.
now
-
start_time
)
/
60
threshold_exceeded_index
=
[
p1_threshold
,
p2_threshold
,
p3_threshold
,
p4_threshold
].
index
{
|
t
|
time_elapsed
>=
t
}
if
threshold_exceeded_index
failed
=
threshold_exceeded_index
==
0
raise
"Search
#{
failed
?
'failed'
:
'succeeded'
}
. Time elapsed:
#{
time_elapsed
}
minutes. Recommend filing P
#{
threshold_exceeded_index
+
1
}
bug"
end
QA
::
Runtime
::
Logger
.
debug
(
"Search successfully completed before
#{
p4_threshold
}
minutes."
)
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