@@ -15,7 +15,7 @@ const { server, request, constants, rte } = deps;
15
15
16
16
// endpoint to test
17
17
const endpoint = ( instanceId = constants . TEST_INSTANCE_ID ) =>
18
- request ( server ) . get ( `/instance/${ instanceId } /keys` ) ;
18
+ request ( server ) . post ( `/instance/${ instanceId } /keys` ) ;
19
19
20
20
const responseSchema = Joi . array ( ) . items ( Joi . object ( ) . keys ( {
21
21
total : Joi . number ( ) . integer ( ) . required ( ) ,
@@ -56,7 +56,7 @@ const isKeyInResponse = (body, keyName) => _.find(
56
56
) ,
57
57
)
58
58
59
- describe ( 'GET /instance/:instanceId/keys' , ( ) => {
59
+ describe ( 'POST /instance/:instanceId/keys' , ( ) => {
60
60
// todo: add query validation
61
61
xdescribe ( 'Validation' , ( ) => { } ) ;
62
62
@@ -68,7 +68,7 @@ describe('GET /instance/:instanceId/keys', () => {
68
68
[
69
69
{
70
70
name : 'Should return all keys in utf-8 (by default)' ,
71
- query : {
71
+ data : {
72
72
count : 10_000 ,
73
73
cursor : '0' ,
74
74
} ,
@@ -81,6 +81,8 @@ describe('GET /instance/:instanceId/keys', () => {
81
81
name : 'Should return all keys in utf-8' ,
82
82
query : {
83
83
encoding : 'utf8' ,
84
+ } ,
85
+ data : {
84
86
count : 10_000 ,
85
87
cursor : '0' ,
86
88
} ,
@@ -93,6 +95,8 @@ describe('GET /instance/:instanceId/keys', () => {
93
95
name : 'Should return all keys in ascii' ,
94
96
query : {
95
97
encoding : 'ascii' ,
98
+ } ,
99
+ data : {
96
100
count : 10_000 ,
97
101
cursor : '0' ,
98
102
} ,
@@ -105,6 +109,8 @@ describe('GET /instance/:instanceId/keys', () => {
105
109
name : 'Should return all keys in buffer' ,
106
110
query : {
107
111
encoding : 'buffer' ,
112
+ } ,
113
+ data : {
108
114
count : 10_000 ,
109
115
cursor : '0' ,
110
116
} ,
@@ -126,7 +132,7 @@ describe('GET /instance/:instanceId/keys', () => {
126
132
[
127
133
{
128
134
name : 'Should find key by exact name' ,
129
- query : {
135
+ data : {
130
136
cursor : '0' ,
131
137
match : `${ constants . TEST_RUN_ID } _str_key_1`
132
138
} ,
@@ -153,7 +159,7 @@ describe('GET /instance/:instanceId/keys', () => {
153
159
} ,
154
160
{
155
161
name : 'Should not find key by exact name' ,
156
- query : {
162
+ data : {
157
163
cursor : '0' ,
158
164
match : 'not_exist_key'
159
165
} ,
@@ -179,7 +185,7 @@ describe('GET /instance/:instanceId/keys', () => {
179
185
} ,
180
186
{
181
187
name : 'Should prevent full scan in one request' ,
182
- query : {
188
+ data : {
183
189
count : 100 ,
184
190
cursor : '0' ,
185
191
match : 'not_exist_key*'
@@ -208,7 +214,7 @@ describe('GET /instance/:instanceId/keys', () => {
208
214
} ,
209
215
{
210
216
name : 'Should search by with * in the end' ,
211
- query : {
217
+ data : {
212
218
cursor : '0' ,
213
219
match : `${ constants . TEST_RUN_ID } _str_key_11*`
214
220
} ,
@@ -237,7 +243,7 @@ describe('GET /instance/:instanceId/keys', () => {
237
243
} ,
238
244
{
239
245
name : 'Should search by with * in the beginning' ,
240
- query : {
246
+ data : {
241
247
cursor : '0' ,
242
248
match : '*_key_111'
243
249
} ,
@@ -266,7 +272,7 @@ describe('GET /instance/:instanceId/keys', () => {
266
272
} ,
267
273
{
268
274
name : 'Should search by with * in the middle' ,
269
- query : {
275
+ data : {
270
276
cursor : '0' ,
271
277
match : `${ constants . TEST_RUN_ID } _str_*_111`
272
278
} ,
@@ -293,7 +299,7 @@ describe('GET /instance/:instanceId/keys', () => {
293
299
} ,
294
300
{
295
301
name : 'Should search by with ? in the end' ,
296
- query : {
302
+ data : {
297
303
cursor : '0' ,
298
304
match : `${ constants . TEST_RUN_ID } _str_key_10?`
299
305
} ,
@@ -322,7 +328,7 @@ describe('GET /instance/:instanceId/keys', () => {
322
328
} ,
323
329
{
324
330
name : 'Should search by with [a-b] glob pattern' ,
325
- query : {
331
+ data : {
326
332
cursor : '0' ,
327
333
match : `${ constants . TEST_RUN_ID } _str_key_10[0-5]`
328
334
} ,
@@ -351,7 +357,7 @@ describe('GET /instance/:instanceId/keys', () => {
351
357
} ,
352
358
{
353
359
name : 'Should search by with [a,b,c] glob pattern' ,
354
- query : {
360
+ data : {
355
361
cursor : '0' ,
356
362
match : `${ constants . TEST_RUN_ID } _str_key_10[0,1,2]`
357
363
} ,
@@ -380,7 +386,7 @@ describe('GET /instance/:instanceId/keys', () => {
380
386
} ,
381
387
{
382
388
name : 'Should search by with [abc] glob pattern' ,
383
- query : {
389
+ data : {
384
390
cursor : '0' ,
385
391
match : `${ constants . TEST_RUN_ID } _str_key_10[012]`
386
392
} ,
@@ -409,7 +415,7 @@ describe('GET /instance/:instanceId/keys', () => {
409
415
} ,
410
416
{
411
417
name : 'Should search by with [^a] glob pattern' ,
412
- query : {
418
+ data : {
413
419
cursor : '0' ,
414
420
match : `${ constants . TEST_RUN_ID } _str_key_10[^0]`
415
421
} ,
@@ -438,7 +444,7 @@ describe('GET /instance/:instanceId/keys', () => {
438
444
} ,
439
445
{
440
446
name : 'Should search by with combined glob patterns' ,
441
- query : {
447
+ data : {
442
448
cursor : '0' ,
443
449
match : `${ constants . TEST_RUN_ID } _s?r_*_[1][0-5][^0]`
444
450
} ,
@@ -470,7 +476,7 @@ describe('GET /instance/:instanceId/keys', () => {
470
476
[
471
477
{
472
478
name : 'Should scan all types' ,
473
- query : {
479
+ data : {
474
480
cursor : '0' ,
475
481
} ,
476
482
responseSchema,
@@ -483,7 +489,7 @@ describe('GET /instance/:instanceId/keys', () => {
483
489
} ,
484
490
{
485
491
name : 'Should scan by provided count value' ,
486
- query : {
492
+ data : {
487
493
count : 500 ,
488
494
cursor : '0' ,
489
495
} ,
@@ -517,7 +523,7 @@ describe('GET /instance/:instanceId/keys', () => {
517
523
while ( cursor !== 0 ) {
518
524
await validateApiCall ( {
519
525
endpoint,
520
- query : {
526
+ data : {
521
527
cursor : cursor || 0 ,
522
528
count : 99 ,
523
529
} ,
@@ -542,7 +548,7 @@ describe('GET /instance/:instanceId/keys', () => {
542
548
[
543
549
{
544
550
name : 'Should filter by type (string)' ,
545
- query : {
551
+ data : {
546
552
cursor : '0' ,
547
553
type : 'string' ,
548
554
count : 200 ,
@@ -562,7 +568,7 @@ describe('GET /instance/:instanceId/keys', () => {
562
568
} ,
563
569
{
564
570
name : 'Should filter by type (list)' ,
565
- query : {
571
+ data : {
566
572
cursor : '0' ,
567
573
type : 'list' ,
568
574
count : 200 ,
@@ -582,7 +588,7 @@ describe('GET /instance/:instanceId/keys', () => {
582
588
} ,
583
589
{
584
590
name : 'Should filter by type (set)' ,
585
- query : {
591
+ data : {
586
592
cursor : '0' ,
587
593
type : 'set' ,
588
594
count : 200 ,
@@ -602,7 +608,7 @@ describe('GET /instance/:instanceId/keys', () => {
602
608
} ,
603
609
{
604
610
name : 'Should filter by type (zset)' ,
605
- query : {
611
+ data : {
606
612
cursor : '0' ,
607
613
type : 'zset' ,
608
614
count : 200 ,
@@ -622,7 +628,7 @@ describe('GET /instance/:instanceId/keys', () => {
622
628
} ,
623
629
{
624
630
name : 'Should filter by type (hash)' ,
625
- query : {
631
+ data : {
626
632
cursor : '0' ,
627
633
type : 'hash' ,
628
634
count : 200 ,
@@ -649,7 +655,7 @@ describe('GET /instance/:instanceId/keys', () => {
649
655
[
650
656
{
651
657
name : 'Should filter by type (ReJSON-RL)' ,
652
- query : {
658
+ data : {
653
659
cursor : '0' ,
654
660
type : 'ReJSON-RL' ,
655
661
count : 200 ,
@@ -675,7 +681,7 @@ describe('GET /instance/:instanceId/keys', () => {
675
681
[
676
682
{
677
683
name : 'Should filter by type (timeseries)' ,
678
- query : {
684
+ data : {
679
685
cursor : '0' ,
680
686
type : 'TSDB-TYPE' ,
681
687
count : 200 ,
@@ -701,7 +707,7 @@ describe('GET /instance/:instanceId/keys', () => {
701
707
[
702
708
{
703
709
name : 'Should filter by type (stream)' ,
704
- query : {
710
+ data : {
705
711
cursor : '0' ,
706
712
type : 'stream' ,
707
713
count : 200 ,
@@ -727,7 +733,7 @@ describe('GET /instance/:instanceId/keys', () => {
727
733
[
728
734
{
729
735
name : 'Should filter by type (stream)' ,
730
- query : {
736
+ data : {
731
737
cursor : '0' ,
732
738
type : 'graphdata' ,
733
739
count : 200 ,
@@ -754,7 +760,7 @@ describe('GET /instance/:instanceId/keys', () => {
754
760
[
755
761
{
756
762
name : 'Should scan all types' ,
757
- query : {
763
+ data : {
758
764
cursor : '0' ,
759
765
} ,
760
766
responseSchema,
@@ -780,7 +786,7 @@ describe('GET /instance/:instanceId/keys', () => {
780
786
} ,
781
787
{
782
788
name : 'Should scan by provided count value' ,
783
- query : {
789
+ data : {
784
790
count : 300 ,
785
791
cursor : '0' ,
786
792
} ,
@@ -813,7 +819,7 @@ describe('GET /instance/:instanceId/keys', () => {
813
819
while ( cursor . length > 0 ) {
814
820
await validateApiCall ( {
815
821
endpoint,
816
- query : {
822
+ data : {
817
823
cursor : cursor . join ( '||' ) ,
818
824
count : 99 ,
819
825
} ,
@@ -840,7 +846,7 @@ describe('GET /instance/:instanceId/keys', () => {
840
846
[
841
847
{
842
848
name : 'Should filter by type (string)' ,
843
- query : {
849
+ data : {
844
850
cursor : '0' ,
845
851
type : 'string' ,
846
852
count : 200 ,
@@ -878,7 +884,7 @@ describe('GET /instance/:instanceId/keys', () => {
878
884
[
879
885
{
880
886
name : 'check keyname with non-ASCII symbols should be properly listed' ,
881
- query : {
887
+ data : {
882
888
cursor : '0' ,
883
889
count : 200 ,
884
890
} ,
@@ -908,7 +914,7 @@ describe('GET /instance/:instanceId/keys', () => {
908
914
[
909
915
{
910
916
name : 'Should scan all types' ,
911
- query : {
917
+ data : {
912
918
cursor : '0' ,
913
919
match : key
914
920
} ,
@@ -933,15 +939,15 @@ describe('GET /instance/:instanceId/keys', () => {
933
939
{
934
940
name : 'Should remove key' ,
935
941
endpoint : ( ) => endpoint ( constants . TEST_INSTANCE_ACL_ID ) ,
936
- query : {
942
+ data : {
937
943
cursor : '0' ,
938
944
} ,
939
945
statusCode : 200 ,
940
946
} ,
941
947
{
942
948
name : 'Should throw error if no permissions for "scan" command' ,
943
949
endpoint : ( ) => endpoint ( constants . TEST_INSTANCE_ACL_ID ) ,
944
- query : {
950
+ data : {
945
951
cursor : '0' ,
946
952
} ,
947
953
statusCode : 403 ,
0 commit comments