Merge branch 'v3.1.x'

This commit is contained in:
Torkel Ödegaard 2016-07-23 12:54:23 +02:00
commit 7a2e8324b9
2 changed files with 10 additions and 5 deletions

View File

@ -40,7 +40,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
};
if (options.panelId) {
httpOptions.requestId = 'panel' + options.panelId;
httpOptions.requestId = this.name + '.panelId.' + options.panelId;
}
return this.doGraphiteRequest(httpOptions).then(this.convertDataPointsToMs);

View File

@ -5,7 +5,7 @@ import {GraphiteDatasource} from "../datasource";
describe('graphiteDatasource', function() {
var ctx = new helpers.ServiceTestContext();
var instanceSettings: any = {url: ['']};
var instanceSettings: any = {url: [''], name: 'graphiteProd'};
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
@ -24,9 +24,10 @@ describe('graphiteDatasource', function() {
describe('When querying influxdb with one target using query editor target spec', function() {
var query = {
rangeRaw: { from: 'now-1h', to: 'now' },
targets: [{ target: 'prod1.count' }, {target: 'prod2.count'}],
maxDataPoints: 500,
panelId: 3,
rangeRaw: { from: 'now-1h', to: 'now' },
targets: [{ target: 'prod1.count' }, {target: 'prod2.count'}],
maxDataPoints: 500,
};
var results;
@ -46,6 +47,10 @@ describe('graphiteDatasource', function() {
expect(requestOptions.url).to.be('/render');
});
it('should set unique requestId', function() {
expect(requestOptions.requestId).to.be('graphiteProd.panelId.3');
});
it('should query correctly', function() {
var params = requestOptions.data.split('&');
expect(params).to.contain('target=prod1.count');