Skip to content

Commit f82e012

Browse files
committed
Do not execute DNS lookup in unit tests
Instead use mocked hostname resolver that resolves seed router to itself. DNS lookup takes long time in some environments.
1 parent 2e078e6 commit f82e012

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

test/internal/connection-providers.test.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,22 +1007,16 @@ function newLoadBalancer(routers, readers, writers,
10071007
expirationTime = Integer.MAX_VALUE,
10081008
routerToRoutingTable = {}) {
10091009
const seedRouter = 'server-non-existing-seed-router';
1010-
const loadBalancer = new LoadBalancer(seedRouter, pool || newPool(), NO_OP_DRIVER_CALLBACK);
1011-
loadBalancer._routingTable = new RoutingTable(
1012-
new RoundRobinArray(routers),
1013-
new RoundRobinArray(readers),
1014-
new RoundRobinArray(writers),
1015-
expirationTime
1016-
);
1017-
loadBalancer._rediscovery = new FakeRediscovery(routerToRoutingTable);
1018-
return loadBalancer;
1010+
return newLoadBalancerWithSeedRouter(seedRouter, [seedRouter], routers, readers, writers, expirationTime,
1011+
routerToRoutingTable, pool);
10191012
}
10201013

10211014
function newLoadBalancerWithSeedRouter(seedRouter, seedRouterResolved,
10221015
routers, readers, writers,
10231016
expirationTime = Integer.MAX_VALUE,
1024-
routerToRoutingTable = {}) {
1025-
const loadBalancer = new LoadBalancer(seedRouter, newPool(), NO_OP_DRIVER_CALLBACK);
1017+
routerToRoutingTable = {},
1018+
connectionPool = null) {
1019+
const loadBalancer = new LoadBalancer(seedRouter, connectionPool || newPool(), NO_OP_DRIVER_CALLBACK);
10261020
loadBalancer._routingTable = new RoutingTable(
10271021
new RoundRobinArray(routers),
10281022
new RoundRobinArray(readers),

0 commit comments

Comments
 (0)