mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-15 19:19:35 +08:00
🐛 fix(redis): 修复 Sentinel 切换数据库配置丢失
- 切换 Redis DB 时复用完整 Connect 逻辑,保留 Sentinel、TLS、SSH 等连接参数 - 补充 Sentinel 切 DB 与 Redis RPC 配置字段回归测试
This commit is contained in:
@@ -199,6 +199,30 @@ describe('buildRpcConnectionConfig', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves Redis cluster and Sentinel topology fields for RPC calls', () => {
|
||||
const result = buildRpcConnectionConfig({
|
||||
id: 'conn-redis-sentinel',
|
||||
type: 'redis',
|
||||
host: 'sentinel-a.local',
|
||||
port: '26379' as unknown as number,
|
||||
hosts: ['sentinel-b.local:26379', 'sentinel-c.local:26379'],
|
||||
topology: 'sentinel',
|
||||
user: 'default',
|
||||
password: 'redis-secret',
|
||||
redisSentinelMaster: 'mymaster',
|
||||
redisSentinelUser: 'sentinel-user',
|
||||
redisSentinelPassword: 'sentinel-secret',
|
||||
redisDB: '3' as unknown as number,
|
||||
} as any);
|
||||
|
||||
expect(result.topology).toBe('sentinel');
|
||||
expect(result.hosts).toEqual(['sentinel-b.local:26379', 'sentinel-c.local:26379']);
|
||||
expect(result.redisSentinelMaster).toBe('mymaster');
|
||||
expect(result.redisSentinelUser).toBe('sentinel-user');
|
||||
expect(result.redisSentinelPassword).toBe('sentinel-secret');
|
||||
expect(result.redisDB).toBe(3);
|
||||
});
|
||||
|
||||
it('returns a Wails connection model instance for RPC compatibility', () => {
|
||||
const result = buildRpcConnectionConfig({
|
||||
id: 'conn-model',
|
||||
|
||||
Reference in New Issue
Block a user