TypeScript
test(usage): v4 cache upgrade test waits for the migrated cache write (#17553)
Igor Makowskia0a0e94822a0
diff --git a/apps/server/src/usage/UsageService.test.ts b/apps/server/src/usage/UsageService.test.tsindex 68d2e7c2bbf..9c1e62fe1a7 100644--- a/apps/server/src/usage/UsageService.test.ts+++ b/apps/server/src/usage/UsageService.test.ts@@ -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({