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
f9bfeb34
Commit
f9bfeb34
authored
Mar 06, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove previously moved specs
parent
d77a3f71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
103 deletions
+0
-103
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+0
-103
No files found.
spec/models/project_services/prometheus_service_spec.rb
View file @
f9bfeb34
...
...
@@ -54,109 +54,6 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
end
end
describe
'#environment_metrics'
do
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
context
'with valid data'
do
subject
{
service
.
query
(
:environment
,
environment
)
}
before
do
stub_reactive_cache
(
service
,
prometheus_data
,
environment_query
,
environment
.
id
)
end
it
'returns reactive data'
do
is_expected
.
to
eq
(
prometheus_metrics_data
)
end
end
end
describe
'#matched_metrics'
do
let
(
:matched_metrics_query
)
{
Gitlab
::
Prometheus
::
Queries
::
MatchedMetricQuery
}
let
(
:prometheus_client_wrapper
)
{
double
(
:prometheus_client_wrapper
,
label_values:
nil
)
}
context
'with valid data'
do
subject
{
service
.
query
(
:matched_metrics
)
}
before
do
allow
(
service
).
to
receive
(
:prometheus_client_wrapper
).
and_return
(
prometheus_client_wrapper
)
synchronous_reactive_cache
(
service
)
end
it
'returns reactive data'
do
expect
(
subject
[
:success
]).
to
be_truthy
expect
(
subject
[
:data
]).
to
eq
([])
end
end
end
describe
'#deployment_metrics'
do
let
(
:deployment
)
{
build_stubbed
(
:deployment
)
}
let
(
:deployment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
DeploymentQuery
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
context
'with valid data'
do
subject
{
service
.
query
(
:deployment
,
deployment
)
}
before
do
stub_reactive_cache
(
service
,
prometheus_data
,
deployment_query
,
deployment
.
id
)
end
it
'returns reactive data'
do
expect
(
subject
).
to
eq
(
prometheus_metrics_data
)
end
end
end
describe
'#calculate_reactive_cache'
do
let
(
:environment
)
{
create
(
:environment
,
slug:
'env-slug'
)
}
before
do
service
.
manual_configuration
=
true
service
.
active
=
true
end
subject
do
service
.
calculate_reactive_cache
(
environment_query
.
name
,
environment
.
id
)
end
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
context
'when service is inactive'
do
before
do
service
.
active
=
false
end
it
{
is_expected
.
to
be_nil
}
end
context
'when Prometheus responds with valid data'
do
before
do
stub_all_prometheus_requests
(
environment
.
slug
)
end
it
{
expect
(
subject
.
to_json
).
to
eq
(
prometheus_data
.
to_json
)
}
it
{
expect
(
subject
.
to_json
).
to
eq
(
prometheus_data
.
to_json
)
}
end
[
404
,
500
].
each
do
|
status
|
context
"when Prometheus responds with
#{
status
}
"
do
before
do
stub_all_prometheus_requests
(
environment
.
slug
,
status:
status
,
body:
"QUERY FAILED!"
)
end
it
{
is_expected
.
to
eq
(
success:
false
,
result:
%(#{status} - "QUERY FAILED!")
)
}
end
end
end
describe
'#prometheus_client'
do
context
'manual configuration is enabled'
do
let
(
:api_url
)
{
'http://some_url'
}
...
...
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