Skip to content

Commit da077ac

Browse files
author
Divjot Arora
authored
DRIVERS-720 Add unified tests for LB support (#958)
1 parent a0c8900 commit da077ac

17 files changed

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

0 commit comments

Comments
 (0)