You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-11 22:42:42 +03:00
fix #1671 - add support for all client configurations in cluster
This commit is contained in:
@@ -5,7 +5,7 @@ import { once } from 'events';
|
||||
import { RedisSocketOptions } from './socket';
|
||||
import which from 'which';
|
||||
import { SinonSpy } from 'sinon';
|
||||
import RedisCluster, { RedisClusterType } from './cluster';
|
||||
import RedisCluster, { RedisClusterOptions, RedisClusterType } from './cluster';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Context as MochaContext } from 'mocha';
|
||||
import { promiseTimeout } from './utils';
|
||||
@@ -60,7 +60,7 @@ export enum TestRedisClusters {
|
||||
OPEN
|
||||
}
|
||||
|
||||
export const TEST_REDIS_CLUSTERES: Record<TestRedisClusters, Array<RedisSocketOptions>> = <any>{};
|
||||
export const TEST_REDIS_CLUSTERES: Record<TestRedisClusters, RedisClusterOptions<RedisModules, RedisLuaScripts>> = <any>{};
|
||||
|
||||
let port = 6379;
|
||||
|
||||
@@ -248,9 +248,13 @@ async function spawnPasswordServer(): Promise<void> {
|
||||
}
|
||||
|
||||
async function spawnOpenCluster(): Promise<void> {
|
||||
TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN] = (await spawnGlobalRedisCluster(TestRedisClusters.OPEN, 3)).map(port => ({
|
||||
port
|
||||
}));
|
||||
TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN] = {
|
||||
rootNodes: (await spawnGlobalRedisCluster(TestRedisClusters.OPEN, 3)).map(port => ({
|
||||
socket: {
|
||||
port
|
||||
}
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
before(function () {
|
||||
@@ -314,9 +318,7 @@ export function itWithCluster(
|
||||
it(title, async function () {
|
||||
if (handleMinimumRedisVersion(this, options?.minimumRedisVersion)) return;
|
||||
|
||||
const cluster = RedisCluster.create({
|
||||
rootNodes: TEST_REDIS_CLUSTERES[type]
|
||||
});
|
||||
const cluster = RedisCluster.create(TEST_REDIS_CLUSTERES[type]);
|
||||
|
||||
await cluster.connect();
|
||||
|
||||
@@ -337,7 +339,9 @@ export function itWithDedicatedCluster(title: string, fn: (cluster: RedisCluster
|
||||
const spawnResults = await spawnRedisCluster(null, 3),
|
||||
cluster = RedisCluster.create({
|
||||
rootNodes: [{
|
||||
port: spawnResults[0].port
|
||||
socket: {
|
||||
port: spawnResults[0].port
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user