Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Dec 26, 2024
1 parent 33c99b0 commit 0a89097
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions tests/functional/client/testClientConnections.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,48 +107,45 @@ describe('Client connections', async function test() {
});

it('should not add connections after failover under load', done => {
let doneCalled = false;
const safeDone = err => {
if (!doneCalled) {
doneCalled = true;
done(err);
}
};

sentinel.sentinel('failover', 'scality-s3', (err, res) => {
if (err) {
safeDone(err);
return;
return done(err);
}
assert.strictEqual(res, 'OK');

async.race([
cb => setTimeout(() => {
this.loadgen.emit('finished');
cb();
}, 3000),
return async.race([
cb => {
setTimeout(() => {
this.loadgen.emit('finished');
cb();
}, 3000);
return undefined;
},
cb => {
async.times(
100,
(n, next) => makeRequest(this, next),
() => {
err => {
if (err) return cb(err);
this.loadgen.emit('finished');
cb();
return cb();
},
);
return undefined;
},
], safeDone);
]);
});

sentinelSub.on('message', (chan, message) => {
// Add return statement here
return sentinelSub.once('message', (chan, message) => {
assert.strictEqual(chan, '+slave');
const data = message.split(' ');
const [oldPort, newPort] = [data[3], data[7]];
assert.notStrictEqual(oldPort, newPort);

this.loadgen.on('finished', () => {
return this.loadgen.once('finished', () => {
assert(this.requestsDuringFailover > 1);
safeDone();
return done();
});
});
});
Expand Down

0 comments on commit 0a89097

Please sign in to comment.