mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
More work on new influxdb query editor, #1525
This commit is contained in:
@@ -18,7 +18,7 @@ define([
|
||||
|
||||
});
|
||||
|
||||
describe('series with tags only', function() {
|
||||
describe('series with single tag only', function() {
|
||||
var builder = new InfluxQueryBuilder({
|
||||
measurement: 'cpu',
|
||||
tags: [{key: 'hostname', value: 'server1'}]
|
||||
@@ -27,12 +27,41 @@ define([
|
||||
var query = builder.build();
|
||||
|
||||
it('should generate correct query', function() {
|
||||
expect(query).to.be('SELECT mean(value) FROM "cpu" WHERE $timeFilter ' +
|
||||
'AND hostname=\'server1\' GROUP BY time($interval) ORDER BY asc');
|
||||
expect(query).to.be('SELECT mean(value) FROM "cpu" WHERE hostname=\'server1\' AND $timeFilter'
|
||||
+ ' GROUP BY time($interval) ORDER BY asc');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('series with multiple tags only', function() {
|
||||
var builder = new InfluxQueryBuilder({
|
||||
measurement: 'cpu',
|
||||
tags: [{key: 'hostname', value: 'server1'}, {key: 'app', value: 'email', condition: "AND"}]
|
||||
});
|
||||
|
||||
var query = builder.build();
|
||||
|
||||
it('should generate correct query', function() {
|
||||
expect(query).to.be('SELECT mean(value) FROM "cpu" WHERE hostname=\'server1\' AND app=\'email\' AND ' +
|
||||
'$timeFilter GROUP BY time($interval) ORDER BY asc');
|
||||
});
|
||||
});
|
||||
|
||||
describe('series with groupByTag', function() {
|
||||
var builder = new InfluxQueryBuilder({
|
||||
measurement: 'cpu',
|
||||
tags: [],
|
||||
groupByTags: ["host"]
|
||||
});
|
||||
|
||||
var query = builder.build();
|
||||
|
||||
it('should generate correct query', function() {
|
||||
expect(query).to.be('SELECT mean(value) FROM "cpu" WHERE $timeFilter ' +
|
||||
'GROUP BY time($interval), host ORDER BY asc');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user