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
707700ac
Commit
707700ac
authored
Apr 24, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force GET for metadataRequests, w/ test
parent
006286ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
public/app/plugins/datasource/prometheus/datasource.ts
+1
-1
public/app/plugins/datasource/prometheus/specs/datasource.jest.ts
+20
-0
No files found.
public/app/plugins/datasource/prometheus/datasource.ts
View file @
707700ac
...
...
@@ -84,7 +84,7 @@ export class PrometheusDatasource {
// Use this for tab completion features, wont publish response to other components
metadataRequest(url) {
return this._request(url, null, { silent: true });
return this._request(url, null, {
method: '
GET
',
silent: true });
}
interpolateQueryExpr(value, variable, defaultFormatFn) {
...
...
public/app/plugins/datasource/prometheus/specs/datasource.jest.ts
View file @
707700ac
...
...
@@ -14,6 +14,7 @@ describe('PrometheusDatasource', () => {
};
ctx
.
backendSrvMock
=
{};
ctx
.
templateSrvMock
=
{
replace
:
a
=>
a
,
};
...
...
@@ -23,6 +24,25 @@ describe('PrometheusDatasource', () => {
ctx
.
ds
=
new
PrometheusDatasource
(
instanceSettings
,
q
,
ctx
.
backendSrvMock
,
ctx
.
templateSrvMock
,
ctx
.
timeSrvMock
);
});
describe
(
'Datasource metadata requests'
,
()
=>
{
it
(
'should perform a GET request with the default config'
,
()
=>
{
ctx
.
backendSrvMock
.
datasourceRequest
=
jest
.
fn
();
ctx
.
ds
.
metadataRequest
(
'/foo'
);
expect
(
ctx
.
backendSrvMock
.
datasourceRequest
.
mock
.
calls
.
length
).
toBe
(
1
);
expect
(
ctx
.
backendSrvMock
.
datasourceRequest
.
mock
.
calls
[
0
][
0
].
method
).
toBe
(
'GET'
);
});
it
(
'should still perform a GET request with the DS HTTP method set to POST'
,
()
=>
{
ctx
.
backendSrvMock
.
datasourceRequest
=
jest
.
fn
();
const
postSettings
=
_
.
cloneDeep
(
instanceSettings
);
postSettings
.
jsonData
.
httpMethod
=
'POST'
;
const
ds
=
new
PrometheusDatasource
(
postSettings
,
q
,
ctx
.
backendSrvMock
,
ctx
.
templateSrvMock
,
ctx
.
timeSrvMock
);
ds
.
metadataRequest
(
'/foo'
);
expect
(
ctx
.
backendSrvMock
.
datasourceRequest
.
mock
.
calls
.
length
).
toBe
(
1
);
expect
(
ctx
.
backendSrvMock
.
datasourceRequest
.
mock
.
calls
[
0
][
0
].
method
).
toBe
(
'GET'
);
});
});
describe
(
'When converting prometheus histogram to heatmap format'
,
()
=>
{
beforeEach
(()
=>
{
ctx
.
query
=
{
...
...
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