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
296d3010
Commit
296d3010
authored
Apr 06, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EE::PrometheusAdapter concern
Move validate query spec to CE and drop empty `EE::PrometheusAdapter`
parent
a69f44a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
50 deletions
+23
-50
app/models/concerns/prometheus_adapter.rb
app/models/concerns/prometheus_adapter.rb
+0
-2
ee/app/models/concerns/ee/prometheus_adapter.rb
ee/app/models/concerns/ee/prometheus_adapter.rb
+0
-6
ee/spec/models/concerns/ee/prometheus_adapter_spec.rb
ee/spec/models/concerns/ee/prometheus_adapter_spec.rb
+0
-42
spec/models/concerns/prometheus_adapter_spec.rb
spec/models/concerns/prometheus_adapter_spec.rb
+23
-0
No files found.
app/models/concerns/prometheus_adapter.rb
View file @
296d3010
...
...
@@ -5,8 +5,6 @@ module PrometheusAdapter
included
do
include
ReactiveCaching
# We can't prepend outside of this model due to the use of `included`, so this must stay here.
prepend_if_ee
(
'EE::PrometheusAdapter'
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
self
.
reactive_cache_lease_timeout
=
30
.
seconds
self
.
reactive_cache_refresh_interval
=
30
.
seconds
...
...
ee/app/models/concerns/ee/prometheus_adapter.rb
deleted
100644 → 0
View file @
a69f44a5
# frozen_string_literal: true
module
EE
module
PrometheusAdapter
end
end
ee/spec/models/concerns/ee/prometheus_adapter_spec.rb
deleted
100644 → 0
View file @
a69f44a5
# frozen_string_literal: true
require
'spec_helper'
describe
EE
::
PrometheusAdapter
,
:use_clean_rails_memory_store_caching
do
include
PrometheusHelpers
include
ReactiveCachingHelpers
let
(
:project
)
{
create
(
:prometheus_project
)
}
let
(
:service
)
{
project
.
prometheus_service
}
let
(
:described_class
)
do
Class
.
new
do
include
PrometheusAdapter
end
end
let
(
:environment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
EnvironmentQuery
}
describe
'validate_query'
do
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
let
(
:validation_query
)
{
Gitlab
::
Prometheus
::
Queries
::
ValidateQuery
.
name
}
let
(
:query
)
{
'avg(response)'
}
let
(
:validation_respone
)
{
{
data:
{
valid:
true
}
}
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
context
'with valid data'
do
subject
{
service
.
query
(
:validate
,
query
)
}
before
do
stub_reactive_cache
(
service
,
validation_respone
,
validation_query
,
query
)
end
it
'returns query data'
do
is_expected
.
to
eq
(
query:
{
valid:
true
})
end
end
end
end
spec/models/concerns/prometheus_adapter_spec.rb
View file @
296d3010
...
...
@@ -18,6 +18,29 @@ describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
let
(
:environment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
EnvironmentQuery
}
describe
'#query'
do
describe
'validate_query'
do
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
let
(
:validation_query
)
{
Gitlab
::
Prometheus
::
Queries
::
ValidateQuery
.
name
}
let
(
:query
)
{
'avg(response)'
}
let
(
:validation_respone
)
{
{
data:
{
valid:
true
}
}
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
context
'with valid data'
do
subject
{
service
.
query
(
:validate
,
query
)
}
before
do
stub_reactive_cache
(
service
,
validation_respone
,
validation_query
,
query
)
end
it
'returns query data'
do
is_expected
.
to
eq
(
query:
{
valid:
true
})
end
end
end
describe
'environment'
do
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
...
...
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