test(usage): v4 cache upgrade test waits for the migrated cache write (#17553)

This commit is contained in:
Igor Makowski authored and GitHub committed 2026-10-09 19:59:06 -03:00
1 parent 6586a01f41
commit a0a0e94822
1 file changed
+5 -1
+5 -1
View File
@@ -1175,7 +1175,8 @@ describe("UsageService", () => {
return text;
});
const summary = yield* (yield* UsageService.make).readSummary(WINDOW);
const restarted = yield* UsageService.make;
const summary = yield* restarted.readSummary(WINDOW);
// The live rollout re-parses at the ultrafast rate (10 x 6); the
// deleted one keeps its saved v4 usage at the standard rate (20 x 1).
assert.strictEqual(totalOutputTokens(summary), 30);
@@ -1188,6 +1189,9 @@ describe("UsageService", () => {
yield* Effect.promise(() => NodeFSP.readFile(legacyPath, "utf8")),
legacy,
);
// The migrated cache is written in the background; let it land before
// the layer removes the state directory under it.
yield* restarted.awaitPersisted;
}).pipe(
Effect.provide(
layerService({