You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { Datasource, Metric } from '../src/index';
|
|
|
|
import { DatasourceType } from '../src/metrics/metric';
|
|
|
|
|
|
|
|
import 'jest';
|
|
|
|
|
|
|
|
|
|
|
|
describe('correct Graphite query', function() {
|
|
|
|
let datasource: Datasource = {
|
|
|
|
url: 'http://example.com:1234',
|
|
|
|
type: DatasourceType.GRAPHITE,
|
|
|
|
params: {
|
|
|
|
db: '',
|
|
|
|
q: '',
|
|
|
|
epoch: ''
|
|
|
|
},
|
|
|
|
data: 'target=target=template(hosts.$hostname.cpu, hostname=\"worker1\")&from=00:00_00000000&until=00:00_00000000&maxDataPoints=000'
|
|
|
|
};
|
|
|
|
|
|
|
|
let target = `target=template(hosts.$hostname.cpu, hostname="worker1")`;
|
|
|
|
let query = new Metric(datasource, [target]);
|
|
|
|
|
|
|
|
it("test simple query with time clause", function () {
|
|
|
|
expect(query.metricQuery.getQuery(1534809600000, 1537488000000, 500, 0).url).toBe(
|
|
|
|
`${datasource.url}?target=${target}&from=1534809600&until=1537488000&maxDataPoints=500`
|
|
|
|
)
|
|
|
|
});
|
|
|
|
})
|