-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const IS_READ_ONLY = true; | ||
|
||
export function transformArguments() { | ||
return ['CLUSTER', 'MYSHARDID']; | ||
} | ||
|
||
export declare function transformReply(): string | Buffer; |