Skip to content

Commit eae88db

Browse files
committed
test(server): cover the compaction operation span
1 parent 5f93b69 commit eae88db

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/FoundationPersistence.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,11 @@ it.effect("paces scheduled compaction while preserving retention state and fixed
313313
let activeNanos = 0n;
314314
let eventPages = 0;
315315
const pauses: number[] = [];
316+
const compactionSpans: Tracer.Span[] = [];
316317
const tracer = Tracer.make({
317318
span(options) {
318319
const span = new Tracer.NativeSpan(options);
320+
if (span.name === "ProjectionMaintenance.compactEventStore") compactionSpans.push(span);
319321
const end = span.end.bind(span);
320322
span.end = (time, exit) => {
321323
end(time, exit);
@@ -337,6 +339,10 @@ it.effect("paces scheduled compaction while preserving retention state and fixed
337339
yield* TestClock.adjust("269 millis");
338340
assert.equal(eventPages, 1);
339341
assert.deepEqual(pauses, [270]);
342+
assert.deepEqual(
343+
compactionSpans.map((span) => span.status._tag),
344+
["Started"],
345+
);
340346
// Foreground commits must not extend the compactor's initial scan bounds.
341347
yield* sql`INSERT INTO orchestration_events (
342348
event_id, aggregate_kind, stream_id, stream_version, event_type,
@@ -371,6 +377,10 @@ it.effect("paces scheduled compaction while preserving retention state and fixed
371377
}),
372378
);
373379
assert.deepEqual(pauses, Array(5).fill(270));
380+
assert.deepEqual(
381+
compactionSpans.map((span) => span.status._tag),
382+
["Ended"],
383+
);
374384
assert.deepEqual(yield* sql`SELECT sequence FROM orchestration_events ORDER BY sequence`, [
375385
{ sequence: 1 },
376386
{ sequence: 101 },

0 commit comments

Comments
 (0)