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.

27 lines
851 B

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