test(compression): de-flake rtk_discover sample seeding

seedSamples() persisted two byte-identical raw outputs. The raw-output
filename is keyed on Date.now() (ms) + a content hash (rawOutput.ts), so
two identical captures landing in the same millisecond collapse to one
file (the 2nd write overwrites the 1st) -> sampleCount 1 instead of 2.
Reproduced at ~25% (501/2000 trials), matching the intermittent
Coverage Shard (5/8) failure on fast CI runners. Seed two DISTINCT
captures so the store deterministically holds 2 samples regardless of
timing (0/2000 collisions after the change).
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-01 12:58:43 -03:00
parent fce85136ca
commit b5b7f09838

View File

@@ -27,8 +27,17 @@ const NOISE = [
function seedSamples() {
// retention "always" forces a capture even on a successful (non-failure) output.
// The two captures MUST differ in content: the raw-output filename is keyed on
// Date.now() (ms) + a hash of the content (see rawOutput.ts), so two BYTE-IDENTICAL
// captures that land in the same millisecond collapse to the same filename — the 2nd
// write overwrites the 1st, leaving only 1 sample. That made this test ~25% flaky on
// fast CI runners ("expected 2, got 1"). Distinct content = 2 files regardless of
// timing; two real build runs never emit byte-identical output anyway.
maybePersistRtkRawOutput(NOISE, { retention: "always", command: "gradle build" });
maybePersistRtkRawOutput(NOISE, { retention: "always", command: "gradle build" });
maybePersistRtkRawOutput(`${NOISE}\n> Task :app:test UP-TO-DATE`, {
retention: "always",
command: "gradle build",
});
}
beforeEach(() => {