1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Add support for CLUSTER MYSHARDID (#2528)

* Add support for CLUSTER.MYSHARDID command

* Update CLUSTER_MYSHARDID.ts

* Update CLUSTER_MYSHARDID.spec.ts

* add test and clean code

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
Evis Cheng
2023-09-19 07:31:03 +08:00
committed by GitHub
parent d8ae8cf0ff
commit 8ecfd3ebda
3 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLUSTER_MYSHARDID';
describe('CLUSTER MYSHARDID', () => {
testUtils.isVersionGreaterThanHook([7, 2]);
it('transformArguments', () => {
assert.deepEqual(
transformArguments(),
['CLUSTER', 'MYSHARDID']
);
});
testUtils.testWithCluster('clusterNode.clusterMyShardId', async cluster => {
const client = await cluster.nodeClient(cluster.masters[0]);
assert.equal(
typeof await client.clusterMyShardId(),
'string'
);
}, GLOBAL.CLUSTERS.OPEN);
});

View File

@@ -0,0 +1,7 @@
export const IS_READ_ONLY = true;
export function transformArguments() {
return ['CLUSTER', 'MYSHARDID'];
}
export declare function transformReply(): string | Buffer;