Skip to content

Commit 5fa26f4

Browse files
authored
Merge pull request #3556 from RedisInsight/be/bugfix/RI-5879
fix keys list exact match filtered by type
2 parents 4d206fb + 6f5ee93 commit 5fa26f4

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

redisinsight/api/src/modules/browser/keys/scanner/strategies/cluster.scanner.strategy.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ describe('Cluster Scanner Strategy', () => {
633633
scanned: 10,
634634
},
635635
]);
636-
expect(strategy.getKeysInfo).toHaveBeenCalledWith(mockClusterRedisClient, [Buffer.from(key)], dto.type);
636+
expect(strategy.getKeysInfo).toHaveBeenCalledWith(mockClusterRedisClient, [Buffer.from(key)]);
637637
expect(strategy['scanNodes']).not.toHaveBeenCalled();
638638
});
639639
it('should find exact key when match is escaped glob patter', async () => {
@@ -666,7 +666,6 @@ describe('Cluster Scanner Strategy', () => {
666666
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
667667
mockClusterRedisClient,
668668
[Buffer.from(searchPattern)],
669-
dto.type,
670669
);
671670
expect(strategy['scanNodes']).not.toHaveBeenCalled();
672671
});
@@ -704,7 +703,6 @@ describe('Cluster Scanner Strategy', () => {
704703
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
705704
mockClusterRedisClient,
706705
[Buffer.from(key)],
707-
dto.type,
708706
);
709707
expect(strategy['scanNodes']).not.toHaveBeenCalled();
710708
});
@@ -741,7 +739,6 @@ describe('Cluster Scanner Strategy', () => {
741739
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
742740
mockClusterRedisClient,
743741
[Buffer.from(key)],
744-
dto.type,
745742
);
746743
expect(strategy['scanNodes']).not.toHaveBeenCalled();
747744
});
@@ -779,7 +776,6 @@ describe('Cluster Scanner Strategy', () => {
779776
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
780777
mockClusterRedisClient,
781778
[Buffer.from(key)],
782-
dto.type,
783779
);
784780
expect(strategy['scanNodes']).not.toHaveBeenCalled();
785781
});

redisinsight/api/src/modules/browser/keys/scanner/strategies/cluster.scanner.strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class ClusterScannerStrategy extends ScannerStrategy {
121121
// eslint-disable-next-line no-param-reassign
122122
node.scanned = isNull(node.total) ? 1 : node.total;
123123
});
124-
nodes[0].keys = await this.getKeysInfo(client, [keyName], args.type);
124+
nodes[0].keys = await this.getKeysInfo(client, [keyName]);
125125
nodes[0].keys = nodes[0].keys.filter((key: GetKeyInfoResponse) => {
126126
if (key.ttl === -2) {
127127
return false;

redisinsight/api/src/modules/browser/keys/scanner/strategies/standalone.scanner.strategy.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ describe('StandaloneScannerStrategy', () => {
389389
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
390390
mockStandaloneRedisClient,
391391
[Buffer.from(key)],
392-
dto.type,
393392
);
394393
expect(strategy['scan']).not.toHaveBeenCalled();
395394
});
@@ -413,7 +412,6 @@ describe('StandaloneScannerStrategy', () => {
413412
expect(strategy.getKeysInfo).toHaveBeenCalledWith(
414413
mockStandaloneRedisClient,
415414
[Buffer.from(mockSearchPattern)],
416-
dto.type,
417415
);
418416
expect(strategy['scan']).not.toHaveBeenCalled();
419417
});

redisinsight/api/src/modules/browser/keys/scanner/strategies/standalone.scanner.strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class StandaloneScannerStrategy extends ScannerStrategy {
126126
const keyName = Buffer.from(unescapeRedisGlob(match));
127127
node.cursor = 0;
128128
node.scanned = isNull(node.total) ? 1 : node.total;
129-
node.keys = await this.getKeysInfo(client, [keyName], args.type);
129+
node.keys = await this.getKeysInfo(client, [keyName]);
130130
node.keys = node.keys.filter((key: GetKeyInfoResponse) => {
131131
if (key.ttl === -2) {
132132
return false;

tests/e2e/tests/web/critical-path/browser/filtering.e2e.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,24 @@ test
4444
await browserPage.searchByKeyName(keyName);
4545
// Verify that key was found
4646
const isKeyIsDisplayedInTheList = await browserPage.isKeyIsDisplayedInTheList(keyName);
47-
await t.expect(isKeyIsDisplayedInTheList).ok('The key was found');
47+
await t.expect(isKeyIsDisplayedInTheList).ok('The key was not found');
48+
49+
// Verify that key not found when selecting other key type
50+
await browserPage.selectFilterGroupType(KeyTypesTexts.List);
51+
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyName)).notOk('The key was found by invalid filter');
52+
4853
// Verify that user can see filtering per key name starts when he press Enter or clicks the control to filter per key name
4954
// Clear filter
5055
await t.click(browserPage.clearFilterButton);
5156
// Check the filtering starts by press Enter
5257
await t.typeText(browserPage.filterByPatterSearchInput, 'InvalidText', { replace: true, paste: true });
5358
await t.pressKey('enter');
54-
await t.expect(browserPage.searchAdvices.exists).ok('The filtering is set');
59+
await t.expect(browserPage.searchAdvices.exists).ok('The filtering is not set');
5560
// Check the filtering starts by clicks the control
5661
await browserPage.reloadPage();
5762
await t.typeText(browserPage.filterByPatterSearchInput, 'InvalidText', { replace: true, paste: true });
5863
await t.click(browserPage.searchButton);
59-
await t.expect(browserPage.searchAdvices.exists).ok('The filtering is set');
64+
await t.expect(browserPage.searchAdvices.exists).ok('The filtering is not set');
6065
});
6166
test
6267
.after(async() => {

yarn.lock

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4215,7 +4215,7 @@ brace@^0.11.1:
42154215
resolved "https://registry.yarnpkg.com/brace/-/brace-0.11.1.tgz#4896fcc9d544eef45f4bb7660db320d3b379fe58"
42164216
integrity sha512-Fc8Ne62jJlKHiG/ajlonC4Sd66Pq68fFwK4ihJGNZpGqboc324SQk+lRvMzpPRuJOmfrJefdG8/7JdWX4bzJ2Q==
42174217

4218-
braces@^3.0.2, braces@^3.0.3, braces@~3.0.2:
4218+
braces@^3.0.3, braces@~3.0.2:
42194219
version "3.0.3"
42204220
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
42214221
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
@@ -7094,7 +7094,7 @@ filelist@^1.0.1:
70947094
dependencies:
70957095
minimatch "^5.0.1"
70967096

7097-
fill-range@^7.0.1, fill-range@^7.1.1:
7097+
fill-range@^7.1.1:
70987098
version "7.1.1"
70997099
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
71007100
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
@@ -13439,7 +13439,16 @@ string-length@^4.0.1:
1343913439
char-regex "^1.0.2"
1344013440
strip-ansi "^6.0.0"
1344113441

13442-
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
13442+
"string-width-cjs@npm:string-width@^4.2.0":
13443+
version "4.2.3"
13444+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
13445+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
13446+
dependencies:
13447+
emoji-regex "^8.0.0"
13448+
is-fullwidth-code-point "^3.0.0"
13449+
strip-ansi "^6.0.1"
13450+
13451+
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1344313452
version "4.2.3"
1344413453
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1344513454
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -13553,7 +13562,7 @@ stringify-object@^3.3.0:
1355313562
is-obj "^1.0.1"
1355413563
is-regexp "^1.0.0"
1355513564

13556-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
13565+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
1355713566
version "6.0.1"
1355813567
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1355913568
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -13567,6 +13576,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
1356713576
dependencies:
1356813577
ansi-regex "^4.1.0"
1356913578

13579+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
13580+
version "6.0.1"
13581+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
13582+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
13583+
dependencies:
13584+
ansi-regex "^5.0.1"
13585+
1357013586
strip-ansi@^7.0.1:
1357113587
version "7.1.0"
1357213588
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@@ -15017,7 +15033,7 @@ [email protected], word-wrap@^1.2.3, word-wrap@~1.2.3:
1501715033
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f"
1501815034
integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==
1501915035

15020-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
15036+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
1502115037
version "7.0.0"
1502215038
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1502315039
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -15044,6 +15060,15 @@ wrap-ansi@^6.2.0:
1504415060
string-width "^4.1.0"
1504515061
strip-ansi "^6.0.0"
1504615062

15063+
wrap-ansi@^7.0.0:
15064+
version "7.0.0"
15065+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
15066+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
15067+
dependencies:
15068+
ansi-styles "^4.0.0"
15069+
string-width "^4.1.0"
15070+
strip-ansi "^6.0.0"
15071+
1504715072
wrap-ansi@^8.1.0:
1504815073
version "8.1.0"
1504915074
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)