Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
test(rs-mocks): reduce ha interval to speed test up across the board
Browse files Browse the repository at this point in the history
NODE-1132
  • Loading branch information
mbroadst committed Sep 16, 2017
1 parent 9f197ac commit fc1d35e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 46 deletions.
12 changes: 6 additions & 6 deletions test/tests/functional/rs_mocks/add_remove_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('ReplSet Add Remove (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('ReplSet Add Remove (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -619,7 +619,7 @@ describe('ReplSet Add Remove (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -664,8 +664,8 @@ describe('ReplSet Add Remove (mocks)', function() {
done();
}
);
}, 6000);
}, 3000);
}, 1000);
}, 500);

server.on('left', function(_type, _server) {
if (_type === 'secondary' && _server.name === 'localhost:32003') {
Expand Down Expand Up @@ -848,7 +848,7 @@ describe('ReplSet Add Remove (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down
18 changes: 9 additions & 9 deletions test/tests/functional/rs_mocks/all_servers_close_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('ReplSet All Servers Close (mocks)', function() {
setName: 'rs',
connectionTimeout: 2000,
socketTimeout: 2000,
haInterval: 500,
haInterval: 100,
size: 500
}
);
Expand Down Expand Up @@ -162,9 +162,9 @@ describe('ReplSet All Servers Close (mocks)', function() {
}
);
});
}, 12000);
}, 2500);
}, 2500);
}, 1500);
}, 1000);
}, 500);
});

// Gives proxies a chance to boot up
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('ReplSet All Servers Close (mocks)', function() {
setName: 'rs',
connectionTimeout: 5000,
socketTimeout: 5000,
haInterval: 1000,
haInterval: 100,
size: 1
}
);
Expand All @@ -309,7 +309,7 @@ describe('ReplSet All Servers Close (mocks)', function() {

var intervalId = setInterval(function() {
server.command('admin.$cmd', { ismaster: true }, function() {});
}, 2000);
}, 500);

setTimeout(function() {
die = false;
Expand All @@ -332,9 +332,9 @@ describe('ReplSet All Servers Close (mocks)', function() {
}
);
});
}, 5000);
}, 25000);
}, 2500);
}, 1500);
}, 1000);
}, 500);
});

// Gives proxies a chance to boot up
Expand Down
22 changes: 11 additions & 11 deletions test/tests/functional/rs_mocks/connection_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
});

Expand Down Expand Up @@ -394,7 +394,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -505,7 +505,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -615,7 +615,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1,
secondaryOnlyConnectionAllowed: true
}
Expand Down Expand Up @@ -764,7 +764,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1,
secondaryOnlyConnectionAllowed: true
}
Expand Down Expand Up @@ -1023,7 +1023,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 5000,
socketTimeout: 10000,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -1166,7 +1166,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -1292,7 +1292,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
});

Expand Down Expand Up @@ -1430,7 +1430,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
});

Expand Down Expand Up @@ -1551,7 +1551,7 @@ describe('ReplSet Connection Tests (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1,
secondaryOnlyConnectionAllowed: true
}
Expand Down
8 changes: 4 additions & 4 deletions test/tests/functional/rs_mocks/failover_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('ReplSet Failover (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('ReplSet Failover (mocks)', function() {
setTimeout(function() {
die = false;
currentIsMasterIndex = currentIsMasterIndex + 1;
}, 2500);
}, 500);
}, 100);
});

Expand Down Expand Up @@ -416,7 +416,7 @@ describe('ReplSet Failover (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -446,7 +446,7 @@ describe('ReplSet Failover (mocks)', function() {
setTimeout(function() {
die = false;
currentIsMasterIndex = currentIsMasterIndex + 1;
}, 2500);
}, 500);
}, 100);
});

Expand Down
2 changes: 1 addition & 1 deletion test/tests/functional/rs_mocks/maintanance_mode_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('ReplSet Maintenance Mode (mocks)', function() {
setName: 'rs',
connectionTimeout: 3000,
socketTimeout: 0,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down
12 changes: 6 additions & 6 deletions test/tests/functional/rs_mocks/monitoring_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('ReplSet Monitoring (mocks)', function() {

// Stop responding to any calls (emulate dropping packets on the floor)
if (stopRespondingPrimary) {
delay(10000).then(() => handleMessage(doc));
delay(3000).then(() => handleMessage(doc));
} else {
handleMessage(doc);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('ReplSet Monitoring (mocks)', function() {
setTimeout(function() {
stopRespondingPrimary = true;
currentIsMasterState = 1;
}, 5000);
}, 500);
});

const spy = new ConnectionSpy();
Expand All @@ -181,7 +181,7 @@ describe('ReplSet Monitoring (mocks)', function() {
setName: 'rs',
connectionTimeout: 5000,
socketTimeout: 3000,
haInterval: 2000,
haInterval: 100,
size: 1
}
);
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('ReplSet Monitoring (mocks)', function() {

primaryServer.setMessageHandler(request => {
var doc = request.document;
if (doc.ismaster && currentIsMasterState == 0) {
if (doc.ismaster && currentIsMasterState === 0) {
request.reply(primary[currentIsMasterState]);
}
});
Expand Down Expand Up @@ -363,7 +363,7 @@ describe('ReplSet Monitoring (mocks)', function() {
setName: 'rs',
connectionTimeout: 5000,
socketTimeout: 60000,
haInterval: 200,
haInterval: 100,
size: 1
}
);
Expand All @@ -377,7 +377,7 @@ describe('ReplSet Monitoring (mocks)', function() {
expect(_server.intervalIds.length).to.equal(0);
done();
});
}, 1000);
}, 100);
});

// Gives proxies a chance to boot up
Expand Down
18 changes: 9 additions & 9 deletions test/tests/functional/rs_mocks/read_preferences_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(r.connection.port).to.equal(32002);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(r.connection.port).to.equal(32000);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -507,7 +507,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(__r.connection.port).to.not.equal(port);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -689,7 +689,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(_err).to.be.null;
expect(_r.connection.port).to.equal(32001); // reads from secondary while primary down

mock.cleanup([primaryServer, firstSecondaryServer], spy, () => {
mock.cleanup([server, primaryServer, firstSecondaryServer], spy, () => {
Connection.disableConnectionAccounting();
done();
});
Expand Down Expand Up @@ -883,7 +883,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(__r.connection.port).to.not.equal(32000);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -1057,7 +1057,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(r.connection.port).to.be.oneOf([32000, 32001]);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -1228,7 +1228,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(r.connection.port).to.be.oneOf([32001, 32002]);

mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => {
Connection.disableConnectionAccounting();
Expand Down Expand Up @@ -1343,7 +1343,7 @@ describe('ReplSet Read Preferences (mocks)', function() {
expect(err).to.be.null;
expect(r.connection.port).to.equal(32000);

mock.cleanup([primaryServer, server], spy, () => {
mock.cleanup([server, primaryServer], spy, () => {
Connection.disableConnectionAccounting();
done();
});
Expand Down Expand Up @@ -1506,7 +1506,7 @@ describe('ReplSet Read Preferences (mocks)', function() {

// Shut down mocks
mock.cleanup(
[primaryServer, firstSecondaryServer, secondSecondaryServer, server],
[server, primaryServer, firstSecondaryServer, secondSecondaryServer],
spy,
() => done()
);
Expand Down

0 comments on commit fc1d35e

Please sign in to comment.