Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
46d2067a
Commit
46d2067a
authored
Mar 12, 2018
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prometheus: add tests for heatmap mode
parent
94cf5603
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts
+40
-0
No files found.
public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts
View file @
46d2067a
...
...
@@ -75,4 +75,44 @@ describe('Prometheus Result Transformer', () => {
]);
});
});
describe
(
'When resultFormat is heatmap'
,
()
=>
{
var
response
=
{
status
:
'success'
,
data
:
{
resultType
:
'matrix'
,
result
:
[
{
metric
:
{
__name__
:
'test'
,
job
:
'testjob'
,
le
:
'1'
},
values
:
[[
1445000010
,
'10'
],
[
1445000020
,
'10'
],
[
1445000030
,
'0'
]],
},
{
metric
:
{
__name__
:
'test'
,
job
:
'testjob'
,
le
:
'2'
},
values
:
[[
1445000010
,
'20'
],
[
1445000020
,
'10'
],
[
1445000030
,
'30'
]],
},
{
metric
:
{
__name__
:
'test'
,
job
:
'testjob'
,
le
:
'3'
},
values
:
[[
1445000010
,
'30'
],
[
1445000020
,
'10'
],
[
1445000030
,
'40'
]],
},
],
},
};
it
(
'should convert cumulative histogram to regular'
,
()
=>
{
let
result
=
[];
let
options
=
{
format
:
'heatmap'
,
start
:
1445000010
,
end
:
1445000030
,
legendFormat
:
'{{le}}'
,
};
ctx
.
resultTransformer
.
transform
(
result
,
{
data
:
response
},
options
);
expect
(
result
).
toEqual
([
{
target
:
'1'
,
datapoints
:
[[
10
,
1445000010000
],
[
10
,
1445000020000
],
[
0
,
1445000030000
]]
},
{
target
:
'2'
,
datapoints
:
[[
10
,
1445000010000
],
[
0
,
1445000020000
],
[
30
,
1445000030000
]]
},
{
target
:
'3'
,
datapoints
:
[[
10
,
1445000010000
],
[
0
,
1445000020000
],
[
10
,
1445000030000
]]
},
]);
});
});
});
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