Skip to content

Commit 44ea8f2

Browse files
committed
Close Redis clients cleanly in tests
Use Redis QUIT in key-value store tests so each test waits for the client connection to close before Deno performs leak checks. This avoids pending ioredis disconnect timers being reported as leaks under Deno 2.7.13 while preserving the same test coverage. Assisted-by: Codex:gpt-5.4
1 parent b252698 commit 44ea8f2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/redis/src/kv.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test("RedisKvStore.get()", { ignore }, async () => {
2121
await redis.set(`${keyPrefix}foo::bar`, '"foobar"');
2222
assert.strictEqual(await store.get(["foo", "bar"]), "foobar");
2323
} finally {
24-
redis.disconnect();
24+
await redis.quit();
2525
}
2626
});
2727

@@ -32,7 +32,7 @@ test("RedisKvStore.set()", { ignore }, async () => {
3232
await store.set(["foo", "baz"], "baz");
3333
assert.strictEqual(await redis.get(`${keyPrefix}foo::baz`), '"baz"');
3434
} finally {
35-
redis.disconnect();
35+
await redis.quit();
3636
}
3737
});
3838

@@ -44,7 +44,7 @@ test("RedisKvStore.delete()", { ignore }, async () => {
4444
await store.delete(["foo", "baz"]);
4545
assert.equal(await redis.exists(`${keyPrefix}foo::baz`), 0);
4646
} finally {
47-
redis.disconnect();
47+
await redis.quit();
4848
}
4949
});
5050

@@ -68,7 +68,7 @@ test("RedisKvStore.list()", { ignore }, async () => {
6868
assert(entries.some((e) => e.key[1] === "nested"));
6969
} finally {
7070
await redis.flushdb();
71-
redis.disconnect();
71+
await redis.quit();
7272
}
7373
});
7474

@@ -88,7 +88,7 @@ test("RedisKvStore.list() - single element key", { ignore }, async () => {
8888
assert.strictEqual(entries[0].value, "value-a");
8989
} finally {
9090
await redis.flushdb();
91-
redis.disconnect();
91+
await redis.quit();
9292
}
9393
});
9494

@@ -108,6 +108,6 @@ test("RedisKvStore.list() - empty prefix", { ignore }, async () => {
108108
assert.strictEqual(entries.length, 3);
109109
} finally {
110110
await redis.flushdb();
111-
redis.disconnect();
111+
await redis.quit();
112112
}
113113
});

0 commit comments

Comments
 (0)