mirror of https://codeberg.org/pzp/pzp-db.git
Skip really long test in ci
This commit is contained in:
parent
b4190b0ae2
commit
f93082f38d
|
@ -141,51 +141,57 @@ test('Log deletes', async (t) => {
|
|||
await p(log.close)()
|
||||
})
|
||||
|
||||
await t.test('Many deleted records', { timeout: 3 * 60e3 }, async (t) => {
|
||||
const file = '/tmp/aaol-test-delete-many' + Date.now() + '.log'
|
||||
const log = Log(file, { blockSize: 64 * 1024 })
|
||||
await t.test(
|
||||
'Many deleted records',
|
||||
{ timeout: 3 * 60e3, skip: !!process.env.CI },
|
||||
async (t) => {
|
||||
const file = '/tmp/aaol-test-delete-many' + Date.now() + '.log'
|
||||
const log = Log(file, { blockSize: 64 * 1024 })
|
||||
|
||||
const TOTAL = 100000
|
||||
const offsets = []
|
||||
const logAppend = p(log.append)
|
||||
if (process.env.VERBOSE) console.time('append ' + TOTAL)
|
||||
for (let i = 0; i < TOTAL; i += 1) {
|
||||
const offset = await logAppend(Buffer.from(`hello ${i}`))
|
||||
offsets.push(offset)
|
||||
}
|
||||
assert('appended records')
|
||||
if (process.env.VERBOSE) console.timeEnd('append ' + TOTAL)
|
||||
const TOTAL = 100000
|
||||
const offsets = []
|
||||
const logAppend = p(log.append)
|
||||
if (process.env.VERBOSE) console.time('append ' + TOTAL)
|
||||
for (let i = 0; i < TOTAL; i += 1) {
|
||||
const offset = await logAppend(Buffer.from(`hello ${i}`))
|
||||
offsets.push(offset)
|
||||
}
|
||||
assert('appended records')
|
||||
if (process.env.VERBOSE) console.timeEnd('append ' + TOTAL)
|
||||
|
||||
await p(log.onDrain)()
|
||||
await p(log.onDrain)()
|
||||
|
||||
const logDel = p(log.del)
|
||||
if (process.env.VERBOSE) console.time('delete ' + TOTAL / 2)
|
||||
for (let i = 0; i < TOTAL; i += 2) {
|
||||
await logDel(offsets[i])
|
||||
}
|
||||
if (process.env.VERBOSE) console.timeEnd('delete ' + TOTAL / 2)
|
||||
assert('deleted messages')
|
||||
const logDel = p(log.del)
|
||||
if (process.env.VERBOSE) console.time('delete ' + TOTAL / 2)
|
||||
for (let i = 0; i < TOTAL; i += 2) {
|
||||
await logDel(offsets[i])
|
||||
}
|
||||
if (process.env.VERBOSE) console.timeEnd('delete ' + TOTAL / 2)
|
||||
assert('deleted messages')
|
||||
|
||||
await p(log.onOverwritesFlushed)()
|
||||
await p(log.onOverwritesFlushed)()
|
||||
|
||||
await new Promise((resolve) => {
|
||||
let i = 0
|
||||
log.scan(
|
||||
(offset, rec, length) => {
|
||||
if (i % 2 === 0) {
|
||||
if (rec !== null) assert.fail('record ' + i + ' should be deleted')
|
||||
} else {
|
||||
if (rec === null) assert.fail('record ' + i + ' should be present')
|
||||
await new Promise((resolve) => {
|
||||
let i = 0
|
||||
log.scan(
|
||||
(offset, rec, length) => {
|
||||
if (i % 2 === 0) {
|
||||
if (rec !== null)
|
||||
assert.fail('record ' + i + ' should be deleted')
|
||||
} else {
|
||||
if (rec === null)
|
||||
assert.fail('record ' + i + ' should be present')
|
||||
}
|
||||
i += 1
|
||||
},
|
||||
(err) => {
|
||||
assert.ifError(err)
|
||||
resolve()
|
||||
}
|
||||
i += 1
|
||||
},
|
||||
(err) => {
|
||||
assert.ifError(err)
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
await p(log.close)()
|
||||
})
|
||||
await p(log.close)()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue