Skip to content

Commit 8ecbabc

Browse files
chore(NODE-4409): fix load balanced mode CI (#3329)
1 parent 6c3ac96 commit 8ecbabc

File tree

4 files changed

+100
-9
lines changed

4 files changed

+100
-9
lines changed

.evergreen/config.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,39 @@ tasks:
11231123
- func: install dependencies
11241124
- func: bootstrap mongohoused
11251125
- func: run data lake tests
1126-
- name: test-load-balancer
1126+
- name: test-5.0-load-balanced
1127+
tags:
1128+
- latest
1129+
- sharded_cluster
1130+
- load_balancer
1131+
commands:
1132+
- func: install dependencies
1133+
- func: bootstrap mongo-orchestration
1134+
vars:
1135+
VERSION: '5.0'
1136+
TOPOLOGY: sharded_cluster
1137+
AUTH: auth
1138+
LOAD_BALANCER: 'true'
1139+
- func: start-load-balancer
1140+
- func: run-lb-tests
1141+
- func: stop-load-balancer
1142+
- name: test-6.0-load-balanced
1143+
tags:
1144+
- latest
1145+
- sharded_cluster
1146+
- load_balancer
1147+
commands:
1148+
- func: install dependencies
1149+
- func: bootstrap mongo-orchestration
1150+
vars:
1151+
VERSION: '6.0'
1152+
TOPOLOGY: sharded_cluster
1153+
AUTH: auth
1154+
LOAD_BALANCER: 'true'
1155+
- func: start-load-balancer
1156+
- func: run-lb-tests
1157+
- func: stop-load-balancer
1158+
- name: test-latest-load-balanced
11271159
tags:
11281160
- latest
11291161
- sharded_cluster
@@ -2063,7 +2095,9 @@ buildvariants:
20632095
- test-latest-server-v1-api
20642096
- test-atlas-connectivity
20652097
- test-atlas-data-lake
2066-
- test-load-balancer
2098+
- test-5.0-load-balanced
2099+
- test-6.0-load-balanced
2100+
- test-latest-load-balanced
20672101
- test-auth-kerberos
20682102
- test-auth-ldap
20692103
- test-socks5

.evergreen/generate_evergreen_tasks.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,45 @@ TASKS.push(
126126
]
127127
},
128128
{
129-
name: 'test-load-balancer',
129+
name: 'test-5.0-load-balanced',
130+
tags: ['latest', 'sharded_cluster', 'load_balancer'],
131+
commands: [
132+
{ func: 'install dependencies' },
133+
{
134+
func: 'bootstrap mongo-orchestration',
135+
vars: {
136+
VERSION: '5.0',
137+
TOPOLOGY: 'sharded_cluster',
138+
AUTH: 'auth',
139+
LOAD_BALANCER: 'true',
140+
}
141+
},
142+
{ func: 'start-load-balancer' },
143+
{ func: 'run-lb-tests' },
144+
{ func: 'stop-load-balancer' }
145+
]
146+
},
147+
{
148+
name: 'test-6.0-load-balanced',
149+
tags: ['latest', 'sharded_cluster', 'load_balancer'],
150+
commands: [
151+
{ func: 'install dependencies' },
152+
{
153+
func: 'bootstrap mongo-orchestration',
154+
vars: {
155+
VERSION: '6.0',
156+
TOPOLOGY: 'sharded_cluster',
157+
AUTH: 'auth',
158+
LOAD_BALANCER: 'true',
159+
}
160+
},
161+
{ func: 'start-load-balancer' },
162+
{ func: 'run-lb-tests' },
163+
{ func: 'stop-load-balancer' }
164+
]
165+
},
166+
{
167+
name: 'test-latest-load-balanced',
130168
tags: ['latest', 'sharded_cluster', 'load_balancer'],
131169
commands: [
132170
{ func: 'install dependencies' },

test/integration/node-specific/auto_connect.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ describe('When executing an operation for the first time', () => {
2020
client = this.configuration.newClient();
2121
});
2222

23+
beforeEach('create test namespace', async function () {
24+
const utilClient = this.configuration.newClient();
25+
26+
await utilClient
27+
.db('test')
28+
.createCollection('test')
29+
.catch(() => null);
30+
31+
await utilClient.close();
32+
});
33+
2334
afterEach('cleanup client', async function () {
2435
await client.close();
2536
});

test/readme.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,29 @@ The following steps will walk you through how to start and test a load balancer.
268268
`mongod --configsvr --replSet test --dbpath config1 --bind_ip localhost --port 27217`
269269

270270
Initiate the config server in the shell:
271-
`rs.initiate( { _id: "test", configsvr: true, members: [ { _id: 0, host: "localhost:27217" } ] })`
271+
```shell
272+
mongosh "mongodb://localhost:27217" --exec "rs.initiate( { _id: "test", configsvr: true, members: [ { _id: 0, host: "localhost:27217" } ] })"
273+
```
272274

273275
Create shard replica sets:
274276
`mongod --shardsvr --replSet testing --dbpath repl1 --bind_ip localhost --port 27218 --setParameter enableTestCommands=true`
275277
`mongod --shardsvr --replSet testing --dbpath repl2 --bind_ip localhost --port 27219 --setParameter enableTestCommands=true`
276278
`mongod --shardsvr --replSet testing --dbpath repl3 --bind_ip localhost --port 27220 --setParameter enableTestCommands=true`
277279

278280
Initiate replica set in the shell:
279-
`rs.initiate( { _id: "testing", members: [ { _id: 0, host: "localhost:27218" }, { _id: 1, host: "localhost:27219" }, { _id: 2, host: "localhost:27220" }] })`
281+
```shell
282+
mongosh "mongodb://localhost:27218" --exec "rs.initiate( { _id: "testing", members: [ { _id: 0, host: "localhost:27218" }, { _id: 1, host: "localhost:27219" }, { _id: 2, host: "localhost:27220" }] })"
283+
```
280284

281-
Create mongoses:
285+
Create two mongoses running on ports 27017 and 27018:
282286
`mongos --configdb test/localhost:27217 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter featureFlagLoadBalancer=true --setParameter loadBalancerPort=27050`
283-
`mongos --configdb test/localhost:27217 --port 27018 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter featureFlagLoadBalancer=true --setParameter loadBalancerPort=27051`
287+
`mongos --configdb test/localhost:27217 --port 27018 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter featureFlagLoadBalancer=true --setParameter loadBalancerPort=27051`.
284288

285289
Initiate cluster on mongos in shell:
286-
`sh.addShard("testing/localhost:27218,localhost:27219,localhost:27220")`
287-
`sh.enableSharding("test")`
290+
```shell
291+
mongosh "mongodb://localhost:27017" --exec "sh.addShard("testing/localhost:27218,localhost:27219,localhost:27220")"
292+
mongosh "mongodb://localhost:27017" --exec "sh.enableSharding("test")"
293+
```
288294

289295
1. Create an environment variable named `MONGODB_URI` that stores the URI of the sharded cluster you just created. For example: `export MONGODB_URI="mongodb://host1,host2/"`
290296
1. Install the HAProxy load balancer. For those on macOS, you can install HAProxy with `brew install haproxy`.
@@ -304,6 +310,8 @@ The following steps will walk you through how to start and test a load balancer.
304310
A new file name `lb.env` is automatically created.
305311
1. Source the environment variables using a command like `source lb.env`.
306312
1. Export **each** of the environment variables that were created in `lb.env`. For example: `export SINGLE_MONGOS_LB_URI`.
313+
1. Export the `LOAD_BALANCED` environment variable to 'true': `export LOAD_BALANCED='true'`
314+
1. Disable auth for tests: `export AUTH='noauth'`
307315
1. Run the test suite as you normally would:
308316
```sh
309317
npm run check:test

0 commit comments

Comments
 (0)