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
34d9274c
Commit
34d9274c
authored
Jan 07, 2020
by
Lukas Siatka
Committed by
Lukas Siatka
Jan 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Datasource: fixes prometheus datasource tests - adds align range
parent
94927428
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
public/app/plugins/datasource/prometheus/datasource.test.ts
+24
-4
No files found.
public/app/plugins/datasource/prometheus/datasource.test.ts
View file @
34d9274c
...
...
@@ -1134,7 +1134,17 @@ describe('PrometheusDatasource', () => {
let end = 7 * 24 * 60 * 60;
end -= end % 55;
const start = 0;
const urlExpected = '
proxied
/
api
/
v1
/
query_range
?
query
=
test
' + '
&
start
=
' + start + '
&
end
=
' + end + '
&
step
=
55
';
const step = 55;
const adjusted = alignRange(
start,
end,
step,
getTimeSrv()
.timeRange()
.to.utcOffset() * 60
);
const urlExpected =
'
proxied
/
api
/
v1
/
query_range
?
query
=
test
' + '
&
start
=
' + adjusted.start + '
&
end
=
' + adjusted.end + '
&
step
=
' + step;
getBackendSrvMock().datasourceRequest = jest.fn(() => Promise.resolve(response));
ds.query(query as any);
const res = (getBackendSrvMock().datasourceRequest as jest.Mock<any>).mock.calls[0][0];
...
...
@@ -1384,14 +1394,24 @@ describe('PrometheusDatasource', () => {
let end = 7 * 24 * 60 * 60;
end -= end % 55;
const start = 0;
const step = 55;
const adjusted = alignRange(
start,
end,
step,
getTimeSrv()
.timeRange()
.to.utcOffset() * 60
);
const urlExpected =
'
proxied
/
api
/
v1
/
query_range
?
query
=
' +
encodeURIComponent('
rate
(
test
[
$__interval
])
') +
'
&
start
=
' +
start +
adjusted.
start +
'
&
end
=
' +
end +
'
&
step
=
55
';
adjusted.end +
'
&
step
=
' +
step;
getBackendSrvMock().datasourceRequest = jest.fn(() => Promise.resolve(response));
templateSrv.replace = jest.fn(str => str);
ds.query(query as any);
...
...
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