Commit 8526230b by Torkel Ödegaard

fix(influxdb_08): fixed influxdb 08 query editor issue, fixes #3009

parent 9d04a4c4
......@@ -2,11 +2,11 @@ define([
'angular',
'lodash',
'app/core/utils/datemath',
'./influxSeries',
'./queryBuilder',
'./influx_series',
'./query_builder',
'./directives',
'./queryCtrl',
'./funcEditor',
'./query_ctrl',
'./func_editor',
],
function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) {
'use strict';
......
define([
'./helpers',
'app/plugins/datasource/influxdb_08/datasource',
'app/services/backendSrv',
'app/services/alertSrv'
], function(helpers) {
'use strict';
describe('InfluxDatasource', function() {
///<amd-dependency path="app/plugins/datasource/influxdb_08/datasource"/>
///<amd-dependency path="app/services/backendSrv"/>
///<amd-dependency path="app/services/alertSrv"/>
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
declare var helpers: any;
describe('InfluxDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.services'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv']));
beforeEach(ctx.createService('InfluxDatasource_08'));
beforeEach(function() {
......@@ -18,8 +19,7 @@ define([
describe('When querying influxdb with one target using query editor target spec', function() {
var results;
var urlExpected = "/series?p=mupp&q=select+mean(value)+from+%22test%22"+
"+where+time+%3E+now()-1h+group+by+time(1s)+order+asc";
var urlExpected = "/series?p=mupp&q=select+mean(value)+from+%22test%22+where+time+%3E+now()-1h+group+by+time(1s)+order+asc";
var query = {
rangeRaw: { from: 'now-1h', to: 'now' },
targets: [{ series: 'test', column: 'value', function: 'mean' }],
......@@ -51,8 +51,7 @@ define([
describe('When querying influxdb with one raw query', function() {
var results;
var urlExpected = "/series?p=mupp&q=select+value+from+series"+
"+where+time+%3E+now()-1h";
var urlExpected = "/series?p=mupp&q=select+value+from+series+where+time+%3E+now()-1h";
var query = {
rangeRaw: { from: 'now-1h', to: 'now' },
targets: [{ query: "select value from series where $timeFilter", rawQuery: true }]
......@@ -74,8 +73,7 @@ define([
describe('When issuing annotation query', function() {
var results;
var urlExpected = "/series?p=mupp&q=select+title+from+events.backend_01"+
"+where+time+%3E+now()-1h";
var urlExpected = "/series?p=mupp&q=select+title+from+events.backend_01+where+time+%3E+now()-1h";
var range = { from: 'now-1h', to: 'now' };
var annotation = { query: 'select title from events.$server where $timeFilter' };
......@@ -96,6 +94,4 @@ define([
});
});
});
define([
'app/plugins/datasource/influxdb_08/influxSeries'
], function(InfluxSeries) {
'use strict';
///<amd-dependency path="app/plugins/datasource/influxdb_08/influx_series" name="InfluxSeries"/>
describe('when generating timeseries from influxdb response', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var InfluxSeries: any;
describe('when generating timeseries from influxdb response', function() {
describe('given two series', function() {
var series = new InfluxSeries({
......@@ -158,9 +159,9 @@ define([
});
});
});
describe("when creating annotations from influxdb response", function() {
describe("when creating annotations from influxdb response", function() {
describe('given column mapping for all columns', function() {
var series = new InfluxSeries({
seriesList: [
......@@ -215,6 +216,5 @@ define([
});
});
});
define([
'app/plugins/datasource/influxdb_08/queryBuilder'
], function(InfluxQueryBuilder) {
'use strict';
///<amd-dependency path="app/plugins/datasource/influxdb_08/query_builder" name="InfluxQueryBuilder"/>
describe('InfluxQueryBuilder', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var InfluxQueryBuilder: any;
describe('InfluxQueryBuilder', function() {
describe('series with conditon and group by', function() {
var builder = new InfluxQueryBuilder({
......@@ -73,6 +74,5 @@ define([
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment