Skip to content

Commit d17d15c

Browse files
pullfrog[bot]Trigger.dev RepoOps
authored andcommitted
test(webapp): stub the task identifier cache in unit test setup
Stub the task identifier cache in webapp unit test setup so tests no longer stall retrying an unavailable Redis before falling back to the database. Mono-RevId: 770ab4895119c6e1364c89b61159a997e0acc122
1 parent 1a9f2dc commit d17d15c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/webapp/test/setup.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ vi.mock("~/services/taskMetadataCacheInstance.server", async () => {
137137
return { taskMetadataCacheInstance: new NoopTaskMetadataCache() };
138138
});
139139

140+
// getTaskIdentifiers() reads this cache before falling back to the database. The
141+
// defaulted REDIS_HOST above points it at a Redis CI doesn't run, so each read
142+
// stalls ~20 reconnect cycles (10s cold, ~40s warm) before its caught error.
143+
// Match the module's own behavior without a cache host: miss and fall through.
144+
vi.mock("~/services/taskIdentifierCache.server", () => ({
145+
getTaskIdentifiersFromCache: vi.fn().mockResolvedValue(null),
146+
populateTaskIdentifierCache: vi.fn().mockResolvedValue(undefined),
147+
}));
148+
140149
// The org-data-stores registry singleton is constructed at import (transitively via
141150
// the ClickHouse factory instance, which many presenters pull in). Its ctor fires a
142151
// `forever` pRetry(loadFromDatabase) plus a setInterval reload against db.server's

0 commit comments

Comments
 (0)