Skip to content

Commit d31af2a

Browse files
committed
Fixed issue with nodes masterauth persistency, changed docker container
1 parent da19af8 commit d31af2a

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

packages/client/lib/sentinel/index.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function steadyState(frame: SentinelFramework) {
7878
}
7979

8080
["redis-sentinel-test-password", undefined].forEach(function (password) {
81-
describe.skip(`Sentinel - password = ${password}`, () => {
81+
describe(`Sentinel - password = ${password}`, () => {
8282
const config: RedisSentinelConfig = { sentinelName: "test", numberOfNodes: 3, password: password };
8383
const frame = new SentinelFramework(config);
8484
let tracer = new Array<string>();
@@ -441,7 +441,7 @@ async function steadyState(frame: SentinelFramework) {
441441
assert.equal(await promise, null);
442442
});
443443

444-
it('reserve client, takes a client out of pool', async function () {
444+
it.skip('reserve client, takes a client out of pool', async function () {
445445
this.timeout(30000);
446446

447447
sentinel = frame.getSentinelClient({ masterPoolSize: 2, reserveClient: true });

packages/client/lib/sentinel/test-util.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface RedisServerDocker {
5555
abstract class DockerBase {
5656
async spawnRedisServerDocker({ image, version }: RedisServerDockerConfig, serverArguments: Array<string>, environment?: string): Promise<RedisServerDocker> {
5757
const port = (await portIterator.next()).value;
58-
let cmdLine = `docker run --init -d --network host `;
58+
let cmdLine = `docker run --init -d --network host -e PORT=${port.toString()} `;
5959
if (environment !== undefined) {
6060
cmdLine += `-e ${environment} `;
6161
}
@@ -250,13 +250,13 @@ export class SentinelFramework extends DockerBase {
250250
}
251251

252252
protected async spawnRedisSentinelNodeDocker() {
253-
const imageInfo: RedisServerDockerConfig = this.config.nodeDockerConfig ?? { image: "redis/redis-stack-server", version: "latest" };
253+
const imageInfo: RedisServerDockerConfig = this.config.nodeDockerConfig ?? { image: "redislabs/client-libs-test", version: "8.0-M05-pre" };
254254
const serverArguments: Array<string> = this.config.nodeServerArguments ?? [];
255255
let environment;
256256
if (this.config.password !== undefined) {
257-
environment = `REDIS_ARGS="{port} --requirepass ${this.config.password}"`;
257+
environment = `REDIS_PASSWORD=${this.config.password}`;
258258
} else {
259-
environment = 'REDIS_ARGS="{port}"';
259+
environment = undefined;
260260
}
261261

262262
const docker = await this.spawnRedisServerDocker(imageInfo, serverArguments, environment);
@@ -281,9 +281,6 @@ export class SentinelFramework extends DockerBase {
281281
for (let i = 0; i < (this.config.numberOfNodes ?? 0) - 1; i++) {
282282
promises.push(
283283
this.spawnRedisSentinelNodeDocker().then(async node => {
284-
if (this.config.password !== undefined) {
285-
await node.client.configSet({'masterauth': this.config.password})
286-
}
287284
await node.client.replicaOf('127.0.0.1', master.docker.port);
288285
return node;
289286
})
@@ -406,9 +403,6 @@ export class SentinelFramework extends DockerBase {
406403
const masterPort = await this.getMasterPort();
407404
const newNode = await this.spawnRedisSentinelNodeDocker();
408405

409-
if (this.config.password !== undefined) {
410-
await newNode.client.configSet({'masterauth': this.config.password})
411-
}
412406
await newNode.client.replicaOf('127.0.0.1', masterPort);
413407

414408
this.#nodeList.push(newNode);

0 commit comments

Comments
 (0)