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
db467ad6
Commit
db467ad6
authored
Sep 05, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve MetricGroup test
parent
c54494e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
spec/lib/gitlab/prometheus/metric_group_spec.rb
spec/lib/gitlab/prometheus/metric_group_spec.rb
+19
-7
No files found.
spec/lib/gitlab/prometheus/metric_group_spec.rb
View file @
db467ad6
...
@@ -4,10 +4,10 @@ require 'rails_helper'
...
@@ -4,10 +4,10 @@ require 'rails_helper'
describe
Gitlab
::
Prometheus
::
MetricGroup
do
describe
Gitlab
::
Prometheus
::
MetricGroup
do
describe
'.common_metrics'
do
describe
'.common_metrics'
do
set
(
:project_metric
)
{
create
(
:prometheus_metric
)
}
let!
(
:project_metric
)
{
create
(
:prometheus_metric
)
}
set
(
:common_metric_group_a
)
{
create
(
:prometheus_metric
,
:common
,
group: :aws_elb
)
}
let!
(
:common_metric_group_a
)
{
create
(
:prometheus_metric
,
:common
,
group: :aws_elb
)
}
set
(
:common_metric_group_b_q1
)
{
create
(
:prometheus_metric
,
:common
,
group: :kubernetes
)
}
let!
(
:common_metric_group_b_q1
)
{
create
(
:prometheus_metric
,
:common
,
group: :kubernetes
)
}
set
(
:common_metric_group_b_q2
)
{
create
(
:prometheus_metric
,
:common
,
group: :kubernetes
)
}
let!
(
:common_metric_group_b_q2
)
{
create
(
:prometheus_metric
,
:common
,
group: :kubernetes
)
}
subject
{
described_class
.
common_metrics
}
subject
{
described_class
.
common_metrics
}
...
@@ -16,9 +16,21 @@ describe Gitlab::Prometheus::MetricGroup do
...
@@ -16,9 +16,21 @@ describe Gitlab::Prometheus::MetricGroup do
end
end
it
'returns exactly three metric queries'
do
it
'returns exactly three metric queries'
do
expect
(
subject
.
map
(
&
:metrics
).
flatten
.
map
(
&
:queries
)).
to
contain_exactly
(
expect
(
subject
.
map
(
&
:metrics
).
flatten
.
map
(
&
:id
)).
to
contain_exactly
(
common_metric_group_a
.
queries
,
common_metric_group_b_q1
.
queries
,
common_metric_group_a
.
id
,
common_metric_group_b_q1
.
id
,
common_metric_group_b_q2
.
queries
)
common_metric_group_b_q2
.
id
)
end
end
describe
'.for_project'
do
let!
(
:other_project
)
{
create
(
:project
)
}
let!
(
:project_metric
)
{
create
(
:prometheus_metric
)
}
let!
(
:common_metric
)
{
create
(
:prometheus_metric
,
:common
,
group: :aws_elb
)
}
subject
{
described_class
.
for_project
(
other_project
)
}
it
'returns exactly one common metric'
do
expect
(
subject
.
map
(
&
:metrics
).
flatten
.
map
(
&
:id
)).
to
contain_exactly
(
common_metric
.
id
)
end
end
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