You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
uncomment "should handle live resharding" test
This commit is contained in:
@@ -47,47 +47,48 @@ describe('Cluster', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// testUtils.testWithCluster('should handle live resharding', async cluster => {
|
testUtils.testWithCluster('should handle live resharding', async cluster => {
|
||||||
// const key = 'key',
|
const key = 'key',
|
||||||
// value = 'value';
|
value = 'value';
|
||||||
// await cluster.set(key, value);
|
await cluster.set(key, value);
|
||||||
|
|
||||||
// const slot = calculateSlot(key),
|
const slot = calculateSlot(key),
|
||||||
// from = cluster.getSlotMaster(slot),
|
from = cluster.getSlotMaster(slot),
|
||||||
// to = cluster.getMasters().find(node => node.id !== from.id);
|
to = cluster.getMasters().find(node => node.id !== from.id);
|
||||||
|
|
||||||
// await to!.client.clusterSetSlot(slot, ClusterSlotStates.IMPORTING, from.id);
|
await to!.client.clusterSetSlot(slot, ClusterSlotStates.IMPORTING, from.id);
|
||||||
|
|
||||||
// // should be able to get the key from the original node before it was migrated
|
// should be able to get the key from the original node before it was migrated
|
||||||
// assert.equal(
|
assert.equal(
|
||||||
// await cluster.get(key),
|
await cluster.get(key),
|
||||||
// value
|
value
|
||||||
// );
|
);
|
||||||
|
|
||||||
// await from.client.clusterSetSlot(slot, ClusterSlotStates.MIGRATING, to!.id);
|
await from.client.clusterSetSlot(slot, ClusterSlotStates.MIGRATING, to!.id);
|
||||||
|
|
||||||
// // should be able to get the key from the original node using the "ASKING" command
|
// should be able to get the key from the original node using the "ASKING" command
|
||||||
// assert.equal(
|
assert.equal(
|
||||||
// await cluster.get(key),
|
await cluster.get(key),
|
||||||
// value
|
value
|
||||||
// );
|
);
|
||||||
|
|
||||||
// const { port: toPort } = <any>to!.client.options!.socket;
|
const { port: toPort } = <any>to!.client.options!.socket;
|
||||||
|
|
||||||
// await from.client.migrate(
|
await from.client.migrate(
|
||||||
// '127.0.0.1',
|
'127.0.0.1',
|
||||||
// toPort,
|
toPort,
|
||||||
// key,
|
key,
|
||||||
// 0,
|
0,
|
||||||
// 10
|
10
|
||||||
// );
|
);
|
||||||
|
|
||||||
// // should be able to get the key from the new node
|
// should be able to get the key from the new node
|
||||||
// assert.equal(
|
assert.equal(
|
||||||
// await cluster.get(key),
|
await cluster.get(key),
|
||||||
// value
|
value
|
||||||
// );
|
);
|
||||||
// }, {
|
}, {
|
||||||
// serverArguments: []
|
serverArguments: [],
|
||||||
// });
|
numberOfNodes: 2
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -26,6 +26,7 @@ interface ClientTestOptions<M extends RedisModules, S extends RedisScripts> exte
|
|||||||
interface ClusterTestOptions<M extends RedisModules, S extends RedisScripts> extends CommonTestOptions {
|
interface ClusterTestOptions<M extends RedisModules, S extends RedisScripts> extends CommonTestOptions {
|
||||||
serverArguments: Array<string>;
|
serverArguments: Array<string>;
|
||||||
clusterConfiguration?: Partial<RedisClusterOptions<M, S>>;
|
clusterConfiguration?: Partial<RedisClusterOptions<M, S>>;
|
||||||
|
numberOfNodes?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TestUtils<M extends RedisModules, S extends RedisScripts> {
|
export default class TestUtils<M extends RedisModules, S extends RedisScripts> {
|
||||||
@@ -144,7 +145,10 @@ export default class TestUtils<M extends RedisModules, S extends RedisScripts> {
|
|||||||
before(function () {
|
before(function () {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
|
||||||
dockersPromise = spawnRedisCluster(dockerImage, options.serverArguments);
|
dockersPromise = spawnRedisCluster({
|
||||||
|
...dockerImage,
|
||||||
|
numberOfNodes: options?.numberOfNodes
|
||||||
|
}, options.serverArguments);
|
||||||
return dockersPromise;
|
return dockersPromise;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user