Skip to content

Commit 2cbfd02

Browse files
committed
churn(test): verify CONFIG SET / GET compatibility with Redis 8
- Add tests for Redis 8 search configuration settings - Deprecate Redis Search CONFIG commands in favor of standard CONFIG - Test read-only config restrictions for Redis 8
1 parent c73186d commit 2cbfd02

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

packages/client/lib/commands/CONFIG_GET.spec.ts

+29-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe('CONFIG GET', () => {
1919
);
2020
});
2121
});
22-
2322

2423
testUtils.testWithClient('client.configGet', async client => {
2524
const config = await client.configGet('*');
@@ -29,4 +28,33 @@ describe('CONFIG GET', () => {
2928
assert.equal(typeof value, 'string');
3029
}
3130
}, GLOBAL.SERVERS.OPEN);
31+
32+
testUtils.testWithClient('client.configSet.getSearchConfigSettingTest | Redis >= 8', async client => {
33+
assert.ok(
34+
await client.configGet('search-timeout'),
35+
'OK'
36+
);
37+
}, GLOBAL.SERVERS.OPEN);
38+
39+
testUtils.testWithClient('client.configSet.getTSConfigSettingTest | Redis >= 8', async client => {
40+
assert.ok(
41+
await client.configGet('ts-retention-policy'),
42+
'OK'
43+
);
44+
}, GLOBAL.SERVERS.OPEN);
45+
46+
testUtils.testWithClient('client.configSet.getBFConfigSettingTest | Redis >= 8', async client => {
47+
assert.ok(
48+
await client.configGet('bf-error-rate'),
49+
'OK'
50+
);
51+
}, GLOBAL.SERVERS.OPEN);
52+
53+
testUtils.testWithClient('client.configSet.getCFConfigSettingTest | Redis >= 8', async client => {
54+
assert.ok(
55+
await client.configGet('cf-initial-size'),
56+
'OK'
57+
);
58+
}, GLOBAL.SERVERS.OPEN);
59+
3260
});

packages/client/lib/commands/CONFIG_SET.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,13 @@ describe('CONFIG SET', () => {
3030
'OK'
3131
);
3232
}, GLOBAL.SERVERS.OPEN);
33+
34+
testUtils.testWithClient('client.configSet.setReadOnlySearchConfigTest | Redis >= 8',
35+
async client => {
36+
assert.rejects(
37+
client.configSet('search-max-doctablesize', '0'),
38+
new Error('ERR CONFIG SET failed (possibly related to argument \'search-max-doctablesize\') - can\'t set immutable config')
39+
);
40+
}, GLOBAL.SERVERS.OPEN);
41+
3342
});

packages/search/lib/commands/CONFIG_SET.spec.ts

+36
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,40 @@ describe('FT.CONFIG SET', () => {
1717
'OK'
1818
);
1919
}, GLOBAL.SERVERS.OPEN);
20+
21+
testUtils.testWithClient('setSearchConfigGloballyTest', async client => {
22+
23+
const normalizeObject = obj => JSON.parse(JSON.stringify(obj));
24+
assert.equal(await client.configSet('search-default-dialect', '3'),
25+
'OK', 'CONFIG SET should return OK');
26+
27+
assert.deepEqual(
28+
normalizeObject(await client.configGet('search-default-dialect')),
29+
{ 'search-default-dialect': '3' },
30+
'CONFIG GET should return 3'
31+
);
32+
33+
assert.deepEqual(
34+
normalizeObject(await client.ft.configGet('DEFAULT_DIALECT')),
35+
{ 'DEFAULT_DIALECT': '3' },
36+
'FT.CONFIG GET should return 3'
37+
);
38+
39+
const ftConfigSetResult = await client.ft.configSet('DEFAULT_DIALECT', '2');
40+
assert.equal(normalizeObject(ftConfigSetResult), 'OK', 'FT.CONFIG SET should return OK');
41+
42+
assert.deepEqual(
43+
normalizeObject(await client.ft.configGet('DEFAULT_DIALECT')),
44+
{ 'DEFAULT_DIALECT': '2' },
45+
'FT.CONFIG GET should return 2'
46+
);
47+
48+
assert.deepEqual(
49+
normalizeObject(await client.configGet('search-default-dialect')),
50+
{ 'search-default-dialect': '2' },
51+
'CONFIG GET should return 22'
52+
);
53+
54+
}, GLOBAL.SERVERS.OPEN);
55+
2056
});

packages/search/lib/commands/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,21 @@ export default {
4848
aliasDel: ALIASDEL,
4949
ALIASUPDATE,
5050
aliasUpdate: ALIASUPDATE,
51+
/**
52+
* @deprecated Redis >=8 uses the standard CONFIG command
53+
*/
5154
CONFIG_GET,
55+
/**
56+
* @deprecated Redis >=8 uses the standard CONFIG command
57+
*/
5258
configGet: CONFIG_GET,
59+
/**
60+
* @deprecated Redis >=8 uses the standard CONFIG command
61+
*/
5362
CONFIG_SET,
63+
/**
64+
* @deprecated Redis >=8 uses the standard CONFIG command
65+
*/
5466
configSet: CONFIG_SET,
5567
CREATE,
5668
create: CREATE,

0 commit comments

Comments
 (0)