mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 14:04:50 +00:00
fix(runner): address review findings for output bounds, key rotation, defaults, and generated uploads
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { OutputAccumulator } from './output-accumulator'
|
||||
|
||||
describe('OutputAccumulator', () => {
|
||||
it('does not accumulate rawChunks in memory when disableTempFile is true', () => {
|
||||
const acc = new OutputAccumulator({
|
||||
maxBytes: 1024,
|
||||
maxLines: 50,
|
||||
disableTempFile: true,
|
||||
})
|
||||
|
||||
const chunk = Buffer.from(`${'x'.repeat(2047)}\n`, 'utf-8')
|
||||
for (let i = 0; i < 256; i++) {
|
||||
acc.append(chunk)
|
||||
}
|
||||
acc.finish()
|
||||
|
||||
const internal = acc as unknown as { rawChunks: Buffer[]; tailBytes: number }
|
||||
expect(internal.rawChunks).toEqual([])
|
||||
expect(internal.tailBytes).toBeLessThanOrEqual(1024 * 4)
|
||||
|
||||
const snapshot = acc.snapshot({ persistIfTruncated: false })
|
||||
expect(snapshot.truncation.truncated).toBe(true)
|
||||
expect(snapshot.fullOutputPath).toBeUndefined()
|
||||
expect(Buffer.byteLength(snapshot.content, 'utf-8')).toBeLessThanOrEqual(1024)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user