Skip to content

Commit 4787a96

Browse files
Sync up load balancer specs (#1542)
1 parent dda76c4 commit 4787a96

File tree

5 files changed

+96
-20
lines changed

5 files changed

+96
-20
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Load Balancer Support Tests
2+
3+
______________________________________________________________________
4+
5+
## Introduction
6+
7+
This document describes how drivers should create load balanced clusters for testing and how tests should be executed
8+
for such clusters.
9+
10+
## Testing Requirements
11+
12+
For each server version that supports load balanced clusters, drivers MUST add two Evergreen tasks: one with a sharded
13+
cluster with both authentication and TLS enabled and one with a sharded cluster with authentication and TLS disabled. In
14+
each task, the sharded cluster MUST be configured with two mongos nodes running on localhost ports 27017 and 27018. The
15+
shard and config servers may run on any free ports. Each task MUST also start up two TCP load balancers operating in
16+
round-robin mode: one fronting both mongos servers and one fronting a single mongos.
17+
18+
### Load Balancer Configuration
19+
20+
Drivers MUST use the `run-load-balancer.sh` script in `drivers-evergreen-tools` to start the TCP load balancers for
21+
Evergreen tasks. This script MUST be run after the backing sharded cluster has already been started. The script writes
22+
the URIs of the load balancers to a YAML expansions file, which can be read by drivers via the `expansions.update`
23+
Evergreen command. This will store the URIs into the `SINGLE_MONGOS_LB_URI` and `MULTI_MONGOS_LB_URI` environment
24+
variables.
25+
26+
### Test Runner Configuration
27+
28+
If the backing sharded cluster is configured with TLS enabled, drivers MUST add the relevant TLS options to both
29+
`SINGLE_MONGOS_LB_URI` and `MULTI_MONGOS_LB_URI` to ensure that test clients can connect to the cluster. Drivers MUST
30+
use the final URI stored in `SINGLE_MONGOS_LB_URI` (with additional TLS options if required) to configure internal
31+
clients for test runners (e.g. the internal MongoClient described by the
32+
[Unified Test Format spec](../../unified-test-format/unified-test-format.md)).
33+
34+
In addition to modifying load balancer URIs, drivers MUST also mock server support for returning a `serviceId` field in
35+
`hello` or legacy `hello` command responses when running tests against a load-balanced cluster. This can be done by
36+
using the value of `topologyVersion.processId` to set `serviceId`. This MUST be done for all connections established by
37+
the test runner, including those made by any internal clients.
38+
39+
## Tests
40+
41+
The YAML and JSON files in this directory contain platform-independent tests written in the
42+
[Unified Test Format](../../unified-test-format/unified-test-format.md). Drivers MUST run the following test suites
43+
against a load balanced cluster:
44+
45+
1. All test suites written in the Unified Test Format
46+
2. Retryable Reads
47+
3. Retryable Writes
48+
4. Change Streams
49+
5. Initial DNS Seedlist Discovery

driver-core/src/test/resources/unified-test-format/load-balancers/cursors.json

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "cursors are correctly pinned to connections for load-balanced clusters",
3-
"schemaVersion": "1.3",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
66
"topologies": [
@@ -222,7 +222,10 @@
222222
"reply": {
223223
"cursor": {
224224
"id": {
225-
"$$type": "long"
225+
"$$type": [
226+
"int",
227+
"long"
228+
]
226229
},
227230
"firstBatch": {
228231
"$$type": "array"
@@ -239,7 +242,10 @@
239242
"commandStartedEvent": {
240243
"command": {
241244
"getMore": {
242-
"$$type": "long"
245+
"$$type": [
246+
"int",
247+
"long"
248+
]
243249
},
244250
"collection": "coll0"
245251
},
@@ -333,7 +339,10 @@
333339
"reply": {
334340
"cursor": {
335341
"id": {
336-
"$$type": "long"
342+
"$$type": [
343+
"int",
344+
"long"
345+
]
337346
},
338347
"firstBatch": {
339348
"$$type": "array"
@@ -475,7 +484,10 @@
475484
"reply": {
476485
"cursor": {
477486
"id": {
478-
"$$type": "long"
487+
"$$type": [
488+
"int",
489+
"long"
490+
]
479491
},
480492
"firstBatch": {
481493
"$$type": "array"
@@ -492,7 +504,10 @@
492504
"commandStartedEvent": {
493505
"command": {
494506
"getMore": {
495-
"$$type": "long"
507+
"$$type": [
508+
"int",
509+
"long"
510+
]
496511
},
497512
"collection": "coll0"
498513
},
@@ -605,7 +620,10 @@
605620
"reply": {
606621
"cursor": {
607622
"id": {
608-
"$$type": "long"
623+
"$$type": [
624+
"int",
625+
"long"
626+
]
609627
},
610628
"firstBatch": {
611629
"$$type": "array"
@@ -750,7 +768,10 @@
750768
"reply": {
751769
"cursor": {
752770
"id": {
753-
"$$type": "long"
771+
"$$type": [
772+
"int",
773+
"long"
774+
]
754775
},
755776
"firstBatch": {
756777
"$$type": "array"
@@ -767,7 +788,10 @@
767788
"commandStartedEvent": {
768789
"command": {
769790
"getMore": {
770-
"$$type": "long"
791+
"$$type": [
792+
"int",
793+
"long"
794+
]
771795
},
772796
"collection": "coll0"
773797
},
@@ -858,7 +882,10 @@
858882
"commandStartedEvent": {
859883
"command": {
860884
"getMore": {
861-
"$$type": "long"
885+
"$$type": [
886+
"int",
887+
"long"
888+
]
862889
},
863890
"collection": "coll0"
864891
},
@@ -950,7 +977,10 @@
950977
"commandStartedEvent": {
951978
"command": {
952979
"getMore": {
953-
"$$type": "long"
980+
"$$type": [
981+
"int",
982+
"long"
983+
]
954984
},
955985
"collection": {
956986
"$$type": "string"
@@ -996,11 +1026,6 @@
9961026
},
9971027
{
9981028
"description": "listIndexes pins the cursor to a connection",
999-
"runOnRequirements": [
1000-
{
1001-
"serverless": "forbid"
1002-
}
1003-
],
10041029
"operations": [
10051030
{
10061031
"name": "createIndex",
@@ -1105,7 +1130,10 @@
11051130
"commandStartedEvent": {
11061131
"command": {
11071132
"getMore": {
1108-
"$$type": "long"
1133+
"$$type": [
1134+
"int",
1135+
"long"
1136+
]
11091137
},
11101138
"collection": "coll0"
11111139
},

driver-core/src/test/resources/unified-test-format/load-balancers/non-lb-connection-establishment.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"schemaVersion": "1.3",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "3.6",
76
"topologies": [
87
"single",
98
"sharded"

driver-core/src/test/resources/unified-test-format/load-balancers/sdam-error-handling.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "state change errors are correctly handled",
3-
"schemaVersion": "1.3",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
66
"topologies": [

driver-core/src/test/resources/unified-test-format/load-balancers/transactions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "transactions are correctly pinned to connections for load-balanced clusters",
3-
"schemaVersion": "1.3",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
66
"topologies": [

0 commit comments

Comments
 (0)