diff --git a/packages/client/lib/client/index.spec.ts b/packages/client/lib/client/index.spec.ts index d52086da41..308ce1e9c4 100644 --- a/packages/client/lib/client/index.spec.ts +++ b/packages/client/lib/client/index.spec.ts @@ -477,8 +477,11 @@ describe('Client', () => { assert.ok(id !== isolatedId); }, GLOBAL.SERVERS.OPEN); - async function killClient(client: RedisClientType): Promise { - const onceErrorPromise = once(client, 'error'); + async function killClient( + client: RedisClientType, + errorClient: RedisClientType = client + ): Promise { + const onceErrorPromise = once(errorClient, 'error'); await client.sendCommand(['QUIT']); await Promise.all([ onceErrorPromise, @@ -503,6 +506,10 @@ describe('Client', () => { minimumDockerVersion: [6, 2] // CLIENT INFO }); + testUtils.testWithClient('should propagated errors from "isolated" clients', client => { + return client.executeIsolated(isolated => killClient(isolated, client)); + }, GLOBAL.SERVERS.OPEN); + testUtils.testWithClient('scanIterator', async client => { const promises = [], keys = new Set(); diff --git a/packages/client/lib/client/index.ts b/packages/client/lib/client/index.ts index da0b95bd42..1dd74fa1af 100644 --- a/packages/client/lib/client/index.ts +++ b/packages/client/lib/client/index.ts @@ -189,7 +189,7 @@ export default class RedisClient create: async () => { const duplicate = this.duplicate({ isolationPoolOptions: undefined - }); + }).on('error', err => this.emit('error', err)); await duplicate.connect(); return duplicate; },