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.

28 lines
884 B

import { Datasource, DatasourceType } from '../src/index';
import { GraphiteConnector } from '../src/connectors/graphite';
4 years ago
import 'jest';
2 years ago
4 years ago
describe('correct Graphite query', function() {
let datasource: Datasource = {
url: 'http://example.com:1234',
2 years ago
type: DatasourceType.GRAPHITE,
4 years ago
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 connector = new GraphiteConnector(datasource, [target]);
4 years ago
it("test simple query with time clause", function () {
expect(connector.getQuery(1534809600000, 1537488000000, 500, 0).url).toBe(
4 years ago
`${datasource.url}?target=${target}&from=1534809600&until=1537488000&maxDataPoints=500`
)
});
})