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.
22 lines
836 B
22 lines
836 B
import { PrometheusConnector } from '../src/connectors/prometheus'; |
|
import { DatasourceType } from '../src/connectors'; |
|
|
|
import 'jest'; |
|
|
|
|
|
describe('Test Prometheus time range processing', function() { |
|
let datasource = { |
|
type: DatasourceType.PROMETHEUS, |
|
url: 'api/datasources/proxy/4/api/v1/query_range?query=node_disk_io_time_ms&start=1543411320&end=1543432950&step=30' |
|
} |
|
let targets = []; |
|
let prometheus = new PrometheusConnector(datasource, targets); |
|
|
|
it('check that from/to present in url', function() { |
|
let from = 1234567891234; //milliseconds |
|
let to = 1234567899999; |
|
let query = prometheus.getQuery(from, to, 1000, 0); |
|
expect(query.url.indexOf(`start=${Math.floor(from / 1000)}`) !== -1).toBeTruthy(); |
|
expect(query.url.indexOf(`end=${Math.floor(to / 1000)}`) !== -1).toBeTruthy(); |
|
}); |
|
});
|
|
|