-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-981 Merge new load balancer spec tests #480
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
Changes from all commits
7d5c8bf
813cb17
83c563d
d8032e8
3d6945d
a0f26ed
6c5cfd6
a805be5
2b5d8f5
b4a8d9a
d0b94e8
b44773a
51ef05c
356ad5f
648a550
d87bd06
9f658d0
7515507
ec83001
73ea75d
3597c0f
c29f1ac
c2505c0
33412b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,11 +345,6 @@ impl Connection { | |
}) | ||
} | ||
|
||
/// Whether this connection has a live `PinnedConnectionHandle`. | ||
pub(crate) fn is_pinned(&self) -> bool { | ||
self.pinned_sender.is_some() | ||
} | ||
|
||
/// Close this connection, emitting a `ConnectionClosedEvent` with the supplied reason. | ||
pub(super) fn close_and_drop(mut self, reason: ConnectionClosedReason) { | ||
self.close(reason); | ||
|
@@ -470,12 +465,8 @@ impl PinnedConnectionHandle { | |
}) | ||
} | ||
|
||
/// Return the pinned connection to the normal connection pool. | ||
pub(crate) async fn unpin_connection(&self) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was previously called by cursors on completion, but with the connection potentially shared by a cursor and transaction the unpin now happens (implicitly) when the final |
||
let mut receiver = self.receiver.lock().await; | ||
receiver.close(); | ||
// Ensure any connections buffered in the channel are dropped, returning them to the pool. | ||
while receiver.recv().await.is_some() {} | ||
pub(crate) fn id(&self) -> u32 { | ||
self.id | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ impl<'de> Deserialize<'de> for ReadPreference { | |
"PrimaryPreferred" => Ok(ReadPreference::PrimaryPreferred { | ||
options: preference.options, | ||
}), | ||
"SecondaryPreferred" => Ok(ReadPreference::SecondaryPreferred { | ||
"SecondaryPreferred" | "secondaryPreferred" => Ok(ReadPreference::SecondaryPreferred { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the spec tests uses |
||
options: preference.options, | ||
}), | ||
"Nearest" => Ok(ReadPreference::Nearest { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
=========================== | ||
Load Balancer Support Tests | ||
=========================== | ||
|
||
.. contents:: | ||
|
||
---- | ||
|
||
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.rst>`__). | ||
|
||
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.rst>`_. Drivers MUST run the | ||
following test suites against a load balanced cluster: | ||
|
||
#. All test suites written in the Unified Test Format | ||
#. Retryable Reads | ||
#. Retryable Writes | ||
#. Change Streams | ||
#. Initial DNS Seedlist Discovery |
Uh oh!
There was an error while loading. Please reload this page.