Skip to content

Commit

Permalink
Fixed test timing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DomPeliniAerospike committed Dec 23, 2024
1 parent 0d5b6ed commit 84e44d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parver==0.5
crudini==0.9.4
delocate==0.10.4
mypy==1.10.0
4 changes: 3 additions & 1 deletion ts-test/tests/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@ describe('Queries', function () {
const key = keys[Math.floor(Math.random() * keys.length)]
const record = await client.get(key)
expect(record.ttl).to.equal(3599)
expect(record.ttl).to.be.within(3599, 3600)

})

it('should set TTL to the specified value using query options #slow', async function () {
Expand All @@ -1137,7 +1139,7 @@ describe('Queries', function () {

const key = keys[Math.floor(Math.random() * keys.length)]
const record = await client.get(key)
expect(record.ttl).to.equal(7199)
expect(record.ttl).to.be.within(7199, 7200)
})
})

Expand Down
6 changes: 4 additions & 2 deletions ts-test/tests/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ context('Scans', function () {

const key: any = keys[Math.floor(Math.random() * keys.length)]
const record = await client.get(key)
expect(record.ttl).to.equal(10799)
expect(record.ttl).to.be.within(10799, 10800)
})

it('should set TTL to the specified value with scan options #slow', async function () {
Expand All @@ -410,6 +410,8 @@ context('Scans', function () {
const key: any = keys[Math.floor(Math.random() * keys.length)]
const record = await client.get(key)
expect(record.ttl).to.equal(14399)
expect(record.ttl).to.be.within(14399, 14400)

})

it('should perform a background scan that executes the touch operation #slow', async function () {
Expand All @@ -421,7 +423,7 @@ context('Scans', function () {
const key: any = keys[Math.floor(Math.random() * keys.length)]
const record = await client.get(key)
console.log('After scan-op TTL : %d Key TTL: %d', ttl, record.ttl)
expect(record.ttl).to.equal(ttl - 1)
expect(record.ttl).to.be.within(ttl - 1, ttl)
})
})

Expand Down

0 comments on commit 84e44d8

Please sign in to comment.