Skip to content

Commit 906c8ea

Browse files
committed
test(execution): make the split test independent of the compaction threshold
Built the oversized batch from one huge string, which compaction offloads to a tiny ref as soon as the value threshold drops below it — leaving the batch under the single-write cap and the test silently exercising nothing. Build it from many modest fields instead, which stay inline at any threshold.
1 parent 8bed4ae commit 906c8ea

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

apps/sim/lib/execution/event-buffer.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,21 @@ describe('execution event buffer', () => {
410410
*/
411411
it('splits a batch that exceeds the single-write cap instead of stalling on it', async () => {
412412
mockRedis.incrby.mockResolvedValue(100)
413-
// Each event stays under the 8MiB per-event cap; two of them do not.
414-
const bigPayload = 'x'.repeat(2_500_000)
413+
// Built from many modest fields rather than one huge one: compaction offloads
414+
// individual values over its threshold, so a single large string would leave a
415+
// tiny ref behind and never reach the batch cap. Each event stays under the
416+
// 8MiB per-event cap; two of them do not.
417+
const chunk = 'x'.repeat(100_000)
418+
const wideEvent = () => {
419+
const event = makeEvent('wide')
420+
const data = event.data as Record<string, unknown>
421+
for (let i = 0; i < 45; i++) data[`field${i}`] = chunk
422+
return event
423+
}
415424

416425
const writer = createExecutionEventWriter('exec-1')
417-
await writer.write(makeEvent(bigPayload))
418-
await writer.write(makeEvent(bigPayload))
426+
await writer.write(wideEvent())
427+
await writer.write(wideEvent())
419428
await writer.flush()
420429

421430
expect(persistedEntries).toHaveLength(2)

0 commit comments

Comments
 (0)