@@ -156,6 +156,59 @@ describe('POST /databases/:instanceId/analysis', () => {
156
156
await rte . data . truncate ( ) ;
157
157
} ) ;
158
158
159
+ describe ( 'useSmallerKeys recommendation' , ( ) => {
160
+ // generate 1M keys take a lot of time
161
+ requirements ( '!rte.type=CLUSTER' ) ;
162
+
163
+ [
164
+ {
165
+ name : 'Should create new database analysis with useSmallerKeys recommendation' ,
166
+ data : {
167
+ delimiter : '-' ,
168
+ } ,
169
+ statusCode : 201 ,
170
+ responseSchema,
171
+ before : async ( ) => {
172
+ await rte . data . truncate ( ) ;
173
+ const KEYS_NUMBER = 1_000_006 ;
174
+ await rte . data . generateNKeys ( KEYS_NUMBER , false ) ;
175
+ } ,
176
+ checkFn : async ( { body } ) => {
177
+ expect ( body . recommendations ) . to . include . deep . members ( [
178
+ constants . TEST_SMALLER_KEYS_DATABASE_ANALYSIS_RECOMMENDATION ,
179
+ constants . TEST_COMBINE_SMALL_STRING_TO_HASHES_RECOMMENDATION ,
180
+ ] ) ;
181
+ } ,
182
+ after : async ( ) => {
183
+ expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
184
+ }
185
+ } ,
186
+ ] . map ( mainCheckFn ) ;
187
+ } ) ;
188
+
189
+
190
+ describe ( 'setPassword recommendation' , ( ) => {
191
+ requirements ( '!rte.pass' ) ;
192
+ [
193
+ {
194
+ name : 'Should create new database analysis with useSmallerKeys recommendation' ,
195
+ data : {
196
+ delimiter : '-' ,
197
+ } ,
198
+ statusCode : 201 ,
199
+ responseSchema,
200
+ checkFn : async ( { body } ) => {
201
+ expect ( body . recommendations ) . to . include . deep . members ( [
202
+ constants . TEST_SET_PASSWORD_RECOMMENDATION ,
203
+ ] ) ;
204
+ } ,
205
+ after : async ( ) => {
206
+ expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
207
+ }
208
+ } ,
209
+ ] . map ( mainCheckFn ) ;
210
+ } ) ;
211
+
159
212
[
160
213
{
161
214
name : 'Should create new database analysis with bigHashes recommendation' ,
@@ -169,7 +222,7 @@ describe('POST /databases/:instanceId/analysis', () => {
169
222
await rte . data . generateHugeNumberOfFieldsForHashKey ( NUMBERS_OF_HASH_FIELDS , true ) ;
170
223
} ,
171
224
checkFn : async ( { body } ) => {
172
- expect ( body . recommendations ) . to . deep . eq ( [
225
+ expect ( body . recommendations ) . to . include . deep . members ( [
173
226
constants . TEST_BIG_HASHES_DATABASE_ANALYSIS_RECOMMENDATION ,
174
227
constants . TEST_HASH_HASHTABLE_TO_ZIPLIST_RECOMMENDATION ,
175
228
constants . TEST_COMPRESS_HASH_FIELD_NAMES_RECOMMENDATION ,
@@ -191,7 +244,9 @@ describe('POST /databases/:instanceId/analysis', () => {
191
244
await rte . data . generateHugeNumberOfMembersForSetKey ( NUMBERS_OF_SET_MEMBERS , true ) ;
192
245
} ,
193
246
checkFn : async ( { body } ) => {
194
- expect ( body . recommendations ) . to . deep . eq ( [ constants . TEST_INCREASE_SET_MAX_INTSET_ENTRIES_RECOMMENDATION ] ) ;
247
+ expect ( body . recommendations ) . to . include . deep . members ( [
248
+ constants . TEST_INCREASE_SET_MAX_INTSET_ENTRIES_RECOMMENDATION ,
249
+ ] ) ;
195
250
} ,
196
251
after : async ( ) => {
197
252
expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
@@ -208,7 +263,9 @@ describe('POST /databases/:instanceId/analysis', () => {
208
263
await rte . data . generateStrings ( true ) ;
209
264
} ,
210
265
checkFn : async ( { body } ) => {
211
- expect ( body . recommendations ) . to . deep . eq ( [ constants . TEST_COMBINE_SMALL_STRING_TO_HASHES_RECOMMENDATION ] ) ;
266
+ expect ( body . recommendations ) . to . include . deep . members ( [
267
+ constants . TEST_COMBINE_SMALL_STRING_TO_HASHES_RECOMMENDATION ,
268
+ ] ) ;
212
269
} ,
213
270
after : async ( ) => {
214
271
expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
@@ -226,7 +283,7 @@ describe('POST /databases/:instanceId/analysis', () => {
226
283
await rte . data . generateHugeNumberOfFieldsForHashKey ( NUMBERS_OF_HASH_FIELDS , true ) ;
227
284
} ,
228
285
checkFn : async ( { body } ) => {
229
- expect ( body . recommendations ) . to . deep . eq ( [
286
+ expect ( body . recommendations ) . to . include . deep . members ( [
230
287
constants . TEST_HASH_HASHTABLE_TO_ZIPLIST_RECOMMENDATION ,
231
288
] ) ;
232
289
} ,
@@ -246,7 +303,7 @@ describe('POST /databases/:instanceId/analysis', () => {
246
303
await rte . data . generateHugeNumberOfFieldsForHashKey ( NUMBERS_OF_HASH_FIELDS , true ) ;
247
304
} ,
248
305
checkFn : async ( { body } ) => {
249
- expect ( body . recommendations ) . to . deep . eq ( [
306
+ expect ( body . recommendations ) . to . include . deep . members ( [
250
307
constants . TEST_HASH_HASHTABLE_TO_ZIPLIST_RECOMMENDATION ,
251
308
constants . TEST_COMPRESS_HASH_FIELD_NAMES_RECOMMENDATION ,
252
309
] ) ;
@@ -267,7 +324,7 @@ describe('POST /databases/:instanceId/analysis', () => {
267
324
await rte . data . generateHugeElementsForListKey ( NUMBERS_OF_LIST_ELEMENTS , true ) ;
268
325
} ,
269
326
checkFn : async ( { body } ) => {
270
- expect ( body . recommendations ) . to . deep . eq ( [
327
+ expect ( body . recommendations ) . to . include . deep . members ( [
271
328
constants . TEST_COMPRESSION_FOR_LIST_RECOMMENDATION ,
272
329
] ) ;
273
330
} ,
@@ -289,7 +346,9 @@ describe('POST /databases/:instanceId/analysis', () => {
289
346
await rte . data . sendCommand ( 'set' , [ constants . TEST_STRING_KEY_1 , bigStringValue ] ) ;
290
347
} ,
291
348
checkFn : async ( { body } ) => {
292
- expect ( body . recommendations ) . to . deep . eq ( [ constants . TEST_BIG_STRINGS_RECOMMENDATION ] ) ;
349
+ expect ( body . recommendations ) . to . include . deep . members ( [
350
+ constants . TEST_BIG_STRINGS_RECOMMENDATION ,
351
+ ] ) ;
293
352
} ,
294
353
after : async ( ) => {
295
354
expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
@@ -307,7 +366,7 @@ describe('POST /databases/:instanceId/analysis', () => {
307
366
await rte . data . generateHugeMembersForSortedListKey ( NUMBERS_OF_ZSET_MEMBERS , true ) ;
308
367
} ,
309
368
checkFn : async ( { body } ) => {
310
- expect ( body . recommendations ) . to . deep . eq ( [
369
+ expect ( body . recommendations ) . to . include . deep . members ( [
311
370
constants . TEST_ZSET_HASHTABLE_TO_ZIPLIST_RECOMMENDATION ,
312
371
] ) ;
313
372
} ,
@@ -327,7 +386,7 @@ describe('POST /databases/:instanceId/analysis', () => {
327
386
await rte . data . generateHugeNumberOfMembersForSetKey ( NUMBERS_OF_SET_MEMBERS , true ) ;
328
387
} ,
329
388
checkFn : async ( { body } ) => {
330
- expect ( body . recommendations ) . to . deep . eq ( [
389
+ expect ( body . recommendations ) . to . include . deep . members ( [
331
390
// by default max_intset_entries = 512
332
391
constants . TEST_INCREASE_SET_MAX_INTSET_ENTRIES_RECOMMENDATION ,
333
392
constants . TEST_BIG_SETS_RECOMMENDATION ,
@@ -348,43 +407,15 @@ describe('POST /databases/:instanceId/analysis', () => {
348
407
await rte . data . generateNCachedScripts ( 11 , true ) ;
349
408
} ,
350
409
checkFn : async ( { body } ) => {
351
- expect ( body . recommendations ) . to . deep . eq ( [ constants . TEST_LUA_DATABASE_ANALYSIS_RECOMMENDATION ] ) ;
410
+ expect ( body . recommendations ) . to . include . deep . members ( [
411
+ constants . TEST_LUA_DATABASE_ANALYSIS_RECOMMENDATION ,
412
+ ] ) ;
352
413
} ,
353
414
after : async ( ) => {
354
415
await rte . data . sendCommand ( 'script' , [ 'flush' ] ) ;
355
416
expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
356
417
}
357
418
} ,
358
419
] . map ( mainCheckFn ) ;
359
-
360
- describe ( 'useSmallerKeys recommendation' , ( ) => {
361
- // generate 1M keys take a lot of time
362
- requirements ( '!rte.type=CLUSTER' ) ;
363
-
364
- [
365
- {
366
- name : 'Should create new database analysis with useSmallerKeys recommendation' ,
367
- data : {
368
- delimiter : '-' ,
369
- } ,
370
- statusCode : 201 ,
371
- responseSchema,
372
- before : async ( ) => {
373
- await rte . data . truncate ( ) ;
374
- const KEYS_NUMBER = 1_000_006 ;
375
- await rte . data . generateNKeys ( KEYS_NUMBER , false ) ;
376
- } ,
377
- checkFn : async ( { body } ) => {
378
- expect ( body . recommendations ) . to . deep . eq ( [
379
- constants . TEST_SMALLER_KEYS_DATABASE_ANALYSIS_RECOMMENDATION ,
380
- constants . TEST_COMBINE_SMALL_STRING_TO_HASHES_RECOMMENDATION ,
381
- ] ) ;
382
- } ,
383
- after : async ( ) => {
384
- expect ( await repository . count ( ) ) . to . eq ( 5 ) ;
385
- }
386
- } ,
387
- ] . map ( mainCheckFn ) ;
388
- } ) ;
389
420
} ) ;
390
421
} ) ;
0 commit comments