T-16: M0.1b — Make repo-wide bun test green: fix queue, shutdown-signal and research-workflow test failures

This commit is contained in:
Studio 2026-11-27 12:14:24 -05:00
parent e89aa6cf2c
commit 512be9d95a
2 changed files with 49 additions and 22 deletions

View file

@ -27,11 +27,13 @@ if (!testRedisUrl) {
describe.skipIf(!testRedisUrl)('RedisCache', () => {
let cache: RedisCache;
let redisConfig: RedisConfig;
let testPrefix: string;
beforeEach(() => {
redisConfig = parseTestRedisConfig(testRedisUrl!);
testPrefix = `test:${crypto.randomUUID()}:`;
const options: CacheOptions = {
keyPrefix: 'test:',
keyPrefix: testPrefix,
ttl: 3600,
shared: false,
redisConfig,
@ -40,7 +42,14 @@ describe.skipIf(!testRedisUrl)('RedisCache', () => {
});
afterEach(async () => {
await cache?.disconnect().catch(() => {});
if (!cache) return;
try {
await cache.clear();
} catch {
// Ignore cleanup errors if Redis is unreachable or already disconnected
} finally {
await cache.disconnect().catch(() => {});
}
});
describe('Core functionality', () => {
@ -174,7 +183,7 @@ describe.skipIf(!testRedisUrl)('RedisCache', () => {
it('should handle errors gracefully in get', async () => {
// Force an error by using invalid JSON
const badCache = new RedisCache({
keyPrefix: 'bad:',
keyPrefix: `bad:${crypto.randomUUID()}:`,
shared: false,
redisConfig,
});
@ -188,6 +197,7 @@ describe.skipIf(!testRedisUrl)('RedisCache', () => {
const stats = badCache.getStats();
expect(stats.misses).toBe(1);
} finally {
await badCache.clear().catch(() => {});
await badCache.disconnect().catch(() => {});
}
});