@@ -84,7 +84,7 @@ interface ClusterTestOptions<
8484 S extends RedisScripts ,
8585 RESP extends RespVersions ,
8686 TYPE_MAPPING extends TypeMapping
87- // POLICIES extends CommandPolicies
87+ // POLICIES extends CommandPolicies
8888> extends CommonTestOptions {
8989 clusterConfiguration ?: Partial < RedisClusterOptions < M , F , S , RESP , TYPE_MAPPING /*, POLICIES*/ > > ;
9090 numberOfMasters ?: number ;
@@ -97,7 +97,7 @@ interface AllTestOptions<
9797 S extends RedisScripts ,
9898 RESP extends RespVersions ,
9999 TYPE_MAPPING extends TypeMapping
100- // POLICIES extends CommandPolicies
100+ // POLICIES extends CommandPolicies
101101> {
102102 client : ClientTestOptions < M , F , S , RESP , TYPE_MAPPING > ;
103103 cluster : ClusterTestOptions < M , F , S , RESP , TYPE_MAPPING /*, POLICIES*/ > ;
@@ -335,7 +335,17 @@ export default class TestUtils {
335335 await fn ( pool ) ;
336336 } finally {
337337 await pool . flushAll ( ) ;
338- pool . destroy ( ) ;
338+ try {
339+ pool . destroy ( ) ;
340+ } catch ( destroyError ) {
341+ if ( destroyError instanceof Error &&
342+ destroyError . message === 'The client is closed' ) {
343+ //TODO figure out where this race condition between destroy and client close is happening
344+ console . warn ( 'Ignoring "client is closed" error during pool destruction' ) ;
345+ } else {
346+ throw destroyError ;
347+ }
348+ }
339349 }
340350 } ) ;
341351 }
@@ -346,7 +356,7 @@ export default class TestUtils {
346356 S extends RedisScripts ,
347357 RESP extends RespVersions ,
348358 TYPE_MAPPING extends TypeMapping
349- // POLICIES extends CommandPolicies
359+ // POLICIES extends CommandPolicies
350360 > ( cluster : RedisClusterType < M , F , S , RESP , TYPE_MAPPING /*, POLICIES*/ > ) : Promise < unknown > {
351361 return Promise . all (
352362 cluster . masters . map ( async master => {
@@ -363,7 +373,7 @@ export default class TestUtils {
363373 S extends RedisScripts = { } ,
364374 RESP extends RespVersions = 2 ,
365375 TYPE_MAPPING extends TypeMapping = { }
366- // POLICIES extends CommandPolicies = {}
376+ // POLICIES extends CommandPolicies = {}
367377 > (
368378 title : string ,
369379 fn : ( cluster : RedisClusterType < M , F , S , RESP , TYPE_MAPPING /*, POLICIES*/ > ) => unknown ,
@@ -387,7 +397,7 @@ export default class TestUtils {
387397
388398 it ( title , async function ( ) {
389399 if ( ! dockersPromise ) return this . skip ( ) ;
390-
400+
391401 const dockers = await dockersPromise ,
392402 cluster = createCluster ( {
393403 rootNodes : dockers . map ( ( { port } ) => ( {
@@ -417,7 +427,7 @@ export default class TestUtils {
417427 S extends RedisScripts = { } ,
418428 RESP extends RespVersions = 2 ,
419429 TYPE_MAPPING extends TypeMapping = { }
420- // POLICIES extends CommandPolicies = {}
430+ // POLICIES extends CommandPolicies = {}
421431 > (
422432 title : string ,
423433 fn : ( client : RedisClientType < M , F , S , RESP , TYPE_MAPPING > | RedisClusterType < M , F , S , RESP , TYPE_MAPPING /*, POLICIES*/ > ) => unknown ,
0 commit comments