Skip to content

Commit

Permalink
feat(test): add testing to PromQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Aganivi committed Aug 8, 2023
1 parent 04a267b commit bc532cd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/promql.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect } from 'chai'
import Greptime from '../src'

describe('Greptime PromQL testing', function () {
const greptime = Greptime({})
const promQL = greptime.promQL

it('PromQL testing', async function () {
const { schema, rows } = await promQL.query('avg(cpu_metrics)').start(1680276000).end(1680576000).step('1s').run()

for (let key of Object.keys(schema[0])) {
expect(key).to.be.oneOf(['name', 'data_type'])
}

for (let i = 1680308000, j = 0; i <= 1680576000; i = i + 1000, j++) {
expect(rows[j][0].toString()).to.be.equal(i.toString())
}
})
})

0 comments on commit bc532cd

Please sign in to comment.