Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync up load balancer specs #1542

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Load Balancer Support Tests

______________________________________________________________________

## Introduction

This document describes how drivers should create load balanced clusters for testing and how tests should be executed
for such clusters.

## Testing Requirements

For each server version that supports load balanced clusters, drivers MUST add two Evergreen tasks: one with a sharded
cluster with both authentication and TLS enabled and one with a sharded cluster with authentication and TLS disabled. In
each task, the sharded cluster MUST be configured with two mongos nodes running on localhost ports 27017 and 27018. The
shard and config servers may run on any free ports. Each task MUST also start up two TCP load balancers operating in
round-robin mode: one fronting both mongos servers and one fronting a single mongos.

### Load Balancer Configuration

Drivers MUST use the `run-load-balancer.sh` script in `drivers-evergreen-tools` to start the TCP load balancers for
Evergreen tasks. This script MUST be run after the backing sharded cluster has already been started. The script writes
the URIs of the load balancers to a YAML expansions file, which can be read by drivers via the `expansions.update`
Evergreen command. This will store the URIs into the `SINGLE_MONGOS_LB_URI` and `MULTI_MONGOS_LB_URI` environment
variables.

### Test Runner Configuration

If the backing sharded cluster is configured with TLS enabled, drivers MUST add the relevant TLS options to both
`SINGLE_MONGOS_LB_URI` and `MULTI_MONGOS_LB_URI` to ensure that test clients can connect to the cluster. Drivers MUST
use the final URI stored in `SINGLE_MONGOS_LB_URI` (with additional TLS options if required) to configure internal
clients for test runners (e.g. the internal MongoClient described by the
[Unified Test Format spec](../../unified-test-format/unified-test-format.md)).

In addition to modifying load balancer URIs, drivers MUST also mock server support for returning a `serviceId` field in
`hello` or legacy `hello` command responses when running tests against a load-balanced cluster. This can be done by
using the value of `topologyVersion.processId` to set `serviceId`. This MUST be done for all connections established by
the test runner, including those made by any internal clients.

## Tests

The YAML and JSON files in this directory contain platform-independent tests written in the
[Unified Test Format](../../unified-test-format/unified-test-format.md). Drivers MUST run the following test suites
against a load balanced cluster:

1. All test suites written in the Unified Test Format
2. Retryable Reads
3. Retryable Writes
4. Change Streams
5. Initial DNS Seedlist Discovery
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "cursors are correctly pinned to connections for load-balanced clusters",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [
Expand Down Expand Up @@ -222,7 +222,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
Expand All @@ -239,7 +242,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
Expand Down Expand Up @@ -333,7 +339,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
Expand Down Expand Up @@ -475,7 +484,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
Expand All @@ -492,7 +504,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
Expand Down Expand Up @@ -605,7 +620,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
Expand Down Expand Up @@ -750,7 +768,10 @@
"reply": {
"cursor": {
"id": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"firstBatch": {
"$$type": "array"
Expand All @@ -767,7 +788,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
Expand Down Expand Up @@ -858,7 +882,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
Expand Down Expand Up @@ -950,7 +977,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": {
"$$type": "string"
Expand Down Expand Up @@ -996,11 +1026,6 @@
},
{
"description": "listIndexes pins the cursor to a connection",
"runOnRequirements": [
{
"serverless": "forbid"
}
],
"operations": [
{
"name": "createIndex",
Expand Down Expand Up @@ -1105,7 +1130,10 @@
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": "long"
"$$type": [
"int",
"long"
]
},
"collection": "coll0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"schemaVersion": "1.3",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"single",
"sharded"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "state change errors are correctly handled",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "transactions are correctly pinned to connections for load-balanced clusters",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"topologies": [
Expand Down