Skip to content

Commit 4f31462

Browse files
committed
chore: fix doc
1 parent 42fa52e commit 4f31462

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

.evergreen/config.in.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ functions:
191191
export SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}"
192192
export SERVERLESS_URI="${SERVERLESS_URI}"
193193
194+
echo "setting SERVERLESS_URI: $SERVERLESS_URI"
195+
194196
export MONGODB_URI="${SERVERLESS_URI}"
195197
export SINGLE_MONGOS_LB_URI="${SERVERLESS_URI}"
196198
197-
# Setting MULTI_MONGOS to the SINGLE_ATLAS is intentional
199+
# Setting MULTI_MONGOS to the SERVERLESS_URI is intentional
198200
# LB tests pick one host out of the comma separated list
199201
# so just passing the one host is equivalent
200202
export MULTI_MONGOS_LB_URI="${SERVERLESS_URI}"

.evergreen/config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,12 @@ functions:
170170
export SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}"
171171
export SERVERLESS_URI="${SERVERLESS_URI}"
172172
173+
echo "setting SERVERLESS_URI: $SERVERLESS_URI"
174+
173175
export MONGODB_URI="${SERVERLESS_URI}"
174176
export SINGLE_MONGOS_LB_URI="${SERVERLESS_URI}"
175177
176-
# Setting MULTI_MONGOS to the SINGLE_ATLAS is intentional
178+
# Setting MULTI_MONGOS to the SERVERLESS_URI is intentional
177179
# LB tests pick one host out of the comma separated list
178180
# so just passing the one host is equivalent
179181
export MULTI_MONGOS_LB_URI="${SERVERLESS_URI}"

.evergreen/run-serverless-tests.sh

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh"
44

55
if [ -z ${SERVERLESS+omitted} ]; then echo "SERVERLESS is unset" && exit 1; fi
6-
if [ -z ${SERVERLESS_URI+omitted} ]; then echo "MULTI_ATLASPROXY_SERVERLESS_URI is unset" && exit 1; fi
6+
if [ -z ${SERVERLESS_URI+omitted} ]; then echo "SERVERLESS_URI is unset" && exit 1; fi
77
if [ -z ${SINGLE_MONGOS_LB_URI+omitted} ]; then echo "SINGLE_MONGOS_LB_URI is unset" && exit 1; fi
88
if [ -z ${MULTI_MONGOS_LB_URI+omitted} ]; then echo "MULTI_MONGOS_LB_URI is unset" && exit 1; fi
99
if [ -z ${MONGODB_URI+omitted} ]; then echo "MONGODB_URI is unset" && exit 1; fi
@@ -15,10 +15,10 @@ npx mocha \
1515
test/integration/crud/crud.spec.test.js \
1616
test/integration/crud/crud.prose.test.js \
1717
test/integration/retryable-reads/retryable_reads.spec.test.js \
18-
test/integration/retryable-writes/retryable_writes.spec.test.js \
19-
test/integration/sessions/sessions.spec.test.js \
20-
test/integration/sessions/sessions.test.js \
18+
test/integration/retryable-writes/retryable_writes.spec.test.ts \
19+
test/integration/sessions/sessions.spec.test.ts \
20+
test/integration/sessions/sessions.test.ts \
2121
test/integration/transactions/transactions.spec.test.js \
22-
test/integration/transactions/transactions.test.js \
22+
test/integration/transactions/transactions.test.ts \
2323
test/integration/versioned-api/versioned_api.spec.test.js \
2424
test/integration/load-balancers/load_balancers.spec.test.js

test/readme.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ The following steps will walk you through how to create and test a MongoDB Serve
231231
AUTH: xxx
232232
TOPOLOGY: xxx
233233
SERVERLESS: xxx
234-
MULTI_ATLASPROXY_SERVERLESS_URI: xxx
235-
SINGLE_ATLASPROXY_SERVERLESS_URI: xxx
234+
SERVERLESS_URI: xxx
236235
```
237236
238237
1. Generate a sourceable environment file from `serverless-expansion.yml` by running the following command:
@@ -245,9 +244,9 @@ The following steps will walk you through how to create and test a MongoDB Serve
245244

246245
1. Update the following variables in `serverless.env`, so that they are equivalent to what our Evergreen builds do:
247246

248-
- Change `MONGODB_URI` to have the same value as `SINGLE_ATLASPROXY_SERVERLESS_URI`.
249-
- Add `SINGLE_MONGOS_LB_URI` and set it to the value of `SINGLE_ATLASPROXY_SERVERLESS_URI`.
250-
- Add `MULTI_MONGOS_LB_URI` and set it to the value of `SINGLE_ATLASPROXY_SERVERLESS_URI`.
247+
- Change `MONGODB_URI` to have the same value as `SERVERLESS_URI`.
248+
- Add `SINGLE_MONGOS_LB_URI` and set it to the value of `SERVERLESS_URI`.
249+
- Add `MULTI_MONGOS_LB_URI` and set it to the value of `SERVERLESS_URI`.
251250

252251
1. Source the environment variables using a command like `source serverless.env`.
253252

test/tools/runner/config.ts

+16-9
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export class TestConfiguration {
8787
hostAddresses,
8888
hostAddress: hostAddresses[0],
8989
host: hostAddresses[0].host,
90-
port: typeof hostAddresses[0].host === 'string' ? hostAddresses[0].port : undefined,
90+
port:
91+
typeof hostAddresses[0].host === 'string' && !this.isServerless
92+
? hostAddresses[0].port
93+
: undefined,
9194
db: url.pathname.slice(1) ? url.pathname.slice(1) : 'integration_tests',
9295
replicaSet: url.searchParams.get('replicaSet'),
9396
proxyURIParams: url.searchParams.get('proxyHost')
@@ -112,7 +115,9 @@ export class TestConfiguration {
112115
}
113116

114117
get isLoadBalanced() {
115-
return !!this.singleMongosLoadBalancerUri && !!this.multiMongosLoadBalancerUri;
118+
return (
119+
!!this.singleMongosLoadBalancerUri && !!this.multiMongosLoadBalancerUri && !this.isServerless
120+
);
116121
}
117122

118123
writeConcern() {
@@ -194,7 +199,7 @@ export class TestConfiguration {
194199
delete dbOptions.writeConcern;
195200
}
196201

197-
if (this.topologyType === TopologyType.LoadBalanced) {
202+
if (this.topologyType === TopologyType.LoadBalanced && !this.isServerless) {
198203
dbOptions.loadBalanced = true;
199204
}
200205

@@ -203,10 +208,10 @@ export class TestConfiguration {
203208
}
204209

205210
const urlOptions: url.UrlObject = {
206-
protocol: 'mongodb',
211+
protocol: this.isServerless ? 'mongodb+srv' : 'mongodb',
207212
slashes: true,
208213
hostname: dbHost,
209-
port: dbPort,
214+
port: this.isServerless ? null : dbPort,
210215
query: dbOptions,
211216
pathname: '/'
212217
};
@@ -267,7 +272,8 @@ export class TestConfiguration {
267272

268273
const FILLER_HOST = 'fillerHost';
269274

270-
const url = new URL(`mongodb://${FILLER_HOST}`);
275+
const protocol = this.isServerless ? 'mongodb+srv' : 'mongodb';
276+
const url = new URL(`${protocol}://${FILLER_HOST}`);
271277

272278
if (options.replicaSet) {
273279
url.searchParams.append('replicaSet', options.replicaSet);
@@ -294,7 +300,7 @@ export class TestConfiguration {
294300
url.password = password;
295301
}
296302

297-
if (this.isLoadBalanced) {
303+
if (this.isLoadBalanced && !this.isServerless) {
298304
url.searchParams.append('loadBalanced', 'true');
299305
}
300306

@@ -319,7 +325,8 @@ export class TestConfiguration {
319325
}
320326

321327
let actualHostsString;
322-
if (options.useMultipleMongoses) {
328+
// Ignore multi mongos options in serverless testing.
329+
if (options.useMultipleMongoses && !this.isServerless) {
323330
if (this.isLoadBalanced) {
324331
const multiUri = new ConnectionString(this.multiMongosLoadBalancerUri);
325332
if (multiUri.isSRV) {
@@ -331,7 +338,7 @@ export class TestConfiguration {
331338
actualHostsString = this.options.hostAddresses.map(ha => ha.toString()).join(',');
332339
}
333340
} else {
334-
if (this.isLoadBalanced) {
341+
if (this.isLoadBalanced || this.isServerless) {
335342
const singleUri = new ConnectionString(this.singleMongosLoadBalancerUri);
336343
actualHostsString = singleUri.hosts[0].toString();
337344
} else {

0 commit comments

Comments
 (0)