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
a450d9c2
Commit
a450d9c2
authored
Aug 27, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update importer specs
parent
7acf4e4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
spec/lib/gitlab/metrics/dashboard/importer_spec.rb
spec/lib/gitlab/metrics/dashboard/importer_spec.rb
+27
-16
No files found.
spec/lib/gitlab/metrics/dashboard/importer_spec.rb
View file @
a450d9c2
...
@@ -5,31 +5,42 @@ require 'spec_helper'
...
@@ -5,31 +5,42 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Metrics
::
Dashboard
::
Importer
do
RSpec
.
describe
Gitlab
::
Metrics
::
Dashboard
::
Importer
do
include
MetricsDashboardHelpers
include
MetricsDashboardHelpers
describe
'.execute'
do
let_it_be
(
:dashboard_path
)
{
'.gitlab/dashboards/sample_dashboard.yml'
}
let_it_be
(
:dashboard_path
)
{
'.gitlab/dashboards/sample_dashboard.yml'
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:dashboard_hash
)
{
load_sample_dashboard
}
let_it_be
(
:project
)
{
create
(
:project
)
}
before
do
allow
(
subject
).
to
receive
(
:dashboard_hash
).
and_return
(
dashboard_hash
)
end
subject
{
described_class
.
new
(
dashboard_path
,
project
)
}
subject
{
described_class
.
new
(
dashboard_path
,
project
)
}
before
do
describe
'.execute'
do
allow
(
subject
).
to
receive
(
:dashboard_hash
).
and_return
(
dashboard_hash
)
context
'valid dashboard hash'
do
let
(
:dashboard_hash
)
{
load_sample_dashboard
}
it
'imports metrics to database'
do
expect
{
subject
.
execute
}
.
to
change
{
PrometheusMetric
.
count
}.
from
(
0
).
to
(
3
)
end
end
end
it
'imports metrics to database'
do
context
'invalid dashboard hash'
do
expect
{
subject
.
execute
}
let
(
:dashboard_hash
)
{
{}
}
.
to
change
{
PrometheusMetric
.
count
}.
from
(
0
).
to
(
3
)
it
'returns false'
do
expect
(
subject
.
execute
).
to
be
(
false
)
end
end
end
end
end
describe
'.execute!'
do
describe
'.execute!'
do
let_it_be
(
:dashboard_path
)
{
'.gitlab/dashboards/sample_dashboard.yml'
}
context
'valid dashboard hash'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:dashboard_hash
)
{
load_sample_dashboard
}
subject
{
described_class
.
new
(
dashboard_path
,
project
)
}
before
do
it
'imports metrics to database'
do
allow
(
subject
).
to
receive
(
:dashboard_hash
).
and_return
(
dashboard_hash
)
expect
{
subject
.
execute
}
.
to
change
{
PrometheusMetric
.
count
}.
from
(
0
).
to
(
3
)
end
end
end
context
'invalid dashboard hash'
do
context
'invalid dashboard hash'
do
...
...
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