Skip to content

Commit a132212

Browse files
committed
Update
1 parent 05dae5d commit a132212

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/redis-client/redis-client-sentinel.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ describe("Redis Client (Sentinel)", () => {
5454
expect(redisClient.isCluster).toBe(false);
5555
});
5656

57+
it("prefers master_name field over URI fragment", async () => {
58+
cds.env.requires.redis = {
59+
credentials: {
60+
sentinel_nodes: [{ host: "sentinel.local", port: 26379 }],
61+
master_name: "explicit-master",
62+
uri: "redis://sentinel.local#uri-master",
63+
},
64+
};
65+
66+
const redisClient = RedisClient.create("master-name-test");
67+
await redisClient.createMainClientAndConnect();
68+
69+
expect(redis.createSentinel).toHaveBeenCalledWith(expect.objectContaining({ name: "explicit-master" }));
70+
});
71+
5772
it("uses default port 26379 when not specified", async () => {
5873
cds.env.requires.redis = {
5974
credentials: {

0 commit comments

Comments
 (0)