Merge branch 'master' of github.com:mongodb/mongo-python-driver
This commit is contained in:
commit
891856a6a5
@ -15,7 +15,7 @@ fi
|
||||
createvirtualenv "$PYTHON_BINARY" covenv
|
||||
# Keep in sync with run-tests.sh
|
||||
# coverage >=5 is needed for relative_files=true.
|
||||
pip install -q "coverage>=5,<=7.5"
|
||||
pip install -q "coverage[toml]>=5,<=7.5"
|
||||
|
||||
pip list
|
||||
ls -la coverage/
|
||||
|
||||
@ -2854,7 +2854,7 @@ buildvariants:
|
||||
matrix_spec:
|
||||
platform: rhel7
|
||||
# Python 3.10+ requires OpenSSL 1.1.1+
|
||||
python-version: ["3.8", "3.9", "pypy3.9", "pypy3.10"]
|
||||
python-version: ["3.8", "3.9"]
|
||||
auth-ssl: "*"
|
||||
display_name: "OpenSSL 1.0.2 ${python-version} ${platform} ${auth-ssl}"
|
||||
tasks:
|
||||
@ -3153,7 +3153,7 @@ buildvariants:
|
||||
|
||||
- name: testazurekms-variant
|
||||
display_name: "Azure KMS"
|
||||
run_on: rhel87-small
|
||||
run_on: debian11-small
|
||||
tasks:
|
||||
- name: testazurekms_task_group
|
||||
batchtime: 20160 # Use a batchtime of 14 days as suggested by the CSFLE test README
|
||||
|
||||
@ -67,7 +67,6 @@ createvirtualenv () {
|
||||
|
||||
export PIP_QUIET=1
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade hatch
|
||||
}
|
||||
|
||||
# Usage:
|
||||
|
||||
@ -18,32 +18,111 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import socket
|
||||
import struct
|
||||
import sys
|
||||
from asyncio import AbstractEventLoop, Future
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Union,
|
||||
)
|
||||
|
||||
from pymongo import ssl_support
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pymongo.pyopenssl_context import _sslConn
|
||||
try:
|
||||
from ssl import SSLError, SSLSocket
|
||||
|
||||
_HAVE_SSL = True
|
||||
except ImportError:
|
||||
_HAVE_SSL = False
|
||||
|
||||
try:
|
||||
from pymongo.pyopenssl_context import (
|
||||
BLOCKING_IO_LOOKUP_ERROR,
|
||||
BLOCKING_IO_READ_ERROR,
|
||||
BLOCKING_IO_WRITE_ERROR,
|
||||
_sslConn,
|
||||
)
|
||||
|
||||
_HAVE_PYOPENSSL = True
|
||||
except ImportError:
|
||||
_HAVE_PYOPENSSL = False
|
||||
_sslConn = SSLSocket # type: ignore
|
||||
from pymongo.ssl_support import ( # type: ignore[assignment]
|
||||
BLOCKING_IO_LOOKUP_ERROR,
|
||||
BLOCKING_IO_READ_ERROR,
|
||||
BLOCKING_IO_WRITE_ERROR,
|
||||
)
|
||||
|
||||
_UNPACK_HEADER = struct.Struct("<iiii").unpack
|
||||
_UNPACK_COMPRESSION_HEADER = struct.Struct("<iiB").unpack
|
||||
_POLL_TIMEOUT = 0.5
|
||||
# Errors raised by sockets (and TLS sockets) when in non-blocking mode.
|
||||
BLOCKING_IO_ERRORS = (BlockingIOError, *ssl_support.BLOCKING_IO_ERRORS)
|
||||
BLOCKING_IO_ERRORS = (BlockingIOError, BLOCKING_IO_LOOKUP_ERROR, *ssl_support.BLOCKING_IO_ERRORS)
|
||||
|
||||
|
||||
async def async_sendall(socket: Union[socket.socket, _sslConn], buf: bytes) -> None:
|
||||
timeout = socket.gettimeout()
|
||||
socket.settimeout(0.0)
|
||||
async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
|
||||
timeout = sock.gettimeout()
|
||||
sock.settimeout(0.0)
|
||||
loop = asyncio.get_event_loop()
|
||||
try:
|
||||
await asyncio.wait_for(loop.sock_sendall(socket, buf), timeout=timeout) # type: ignore[arg-type]
|
||||
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
|
||||
if sys.platform == "win32":
|
||||
await asyncio.wait_for(_async_sendall_ssl_windows(sock, buf), timeout=timeout)
|
||||
else:
|
||||
await asyncio.wait_for(_async_sendall_ssl(sock, buf, loop), timeout=timeout)
|
||||
else:
|
||||
await asyncio.wait_for(loop.sock_sendall(sock, buf), timeout=timeout) # type: ignore[arg-type]
|
||||
finally:
|
||||
socket.settimeout(timeout)
|
||||
sock.settimeout(timeout)
|
||||
|
||||
|
||||
def sendall(socket: Union[socket.socket, _sslConn], buf: bytes) -> None:
|
||||
socket.sendall(buf)
|
||||
async def _async_sendall_ssl(
|
||||
sock: Union[socket.socket, _sslConn], buf: bytes, loop: AbstractEventLoop
|
||||
) -> None:
|
||||
fd = sock.fileno()
|
||||
sent = 0
|
||||
|
||||
def _is_ready(fut: Future) -> None:
|
||||
loop.remove_writer(fd)
|
||||
loop.remove_reader(fd)
|
||||
if fut.done():
|
||||
return
|
||||
fut.set_result(None)
|
||||
|
||||
while sent < len(buf):
|
||||
try:
|
||||
sent += sock.send(buf)
|
||||
except BLOCKING_IO_ERRORS as exc:
|
||||
fd = sock.fileno()
|
||||
# Check for closed socket.
|
||||
if fd == -1:
|
||||
raise SSLError("Underlying socket has been closed") from None
|
||||
if isinstance(exc, BLOCKING_IO_READ_ERROR):
|
||||
fut = loop.create_future()
|
||||
loop.add_reader(fd, _is_ready, fut)
|
||||
await fut
|
||||
if isinstance(exc, BLOCKING_IO_WRITE_ERROR):
|
||||
fut = loop.create_future()
|
||||
loop.add_writer(fd, _is_ready, fut)
|
||||
await fut
|
||||
if _HAVE_PYOPENSSL and isinstance(exc, BLOCKING_IO_LOOKUP_ERROR):
|
||||
fut = loop.create_future()
|
||||
loop.add_reader(fd, _is_ready, fut)
|
||||
loop.add_writer(fd, _is_ready, fut)
|
||||
await fut
|
||||
|
||||
|
||||
# The default Windows asyncio event loop does not support loop.add_reader/add_writer: https://docs.python.org/3/library/asyncio-platforms.html#asyncio-platform-support
|
||||
async def _async_sendall_ssl_windows(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
|
||||
view = memoryview(buf)
|
||||
total_length = len(buf)
|
||||
total_sent = 0
|
||||
while total_sent < total_length:
|
||||
try:
|
||||
sent = sock.send(view[total_sent:])
|
||||
except BLOCKING_IO_ERRORS:
|
||||
await asyncio.sleep(0.5)
|
||||
sent = 0
|
||||
total_sent += sent
|
||||
|
||||
|
||||
def sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
|
||||
sock.sendall(buf)
|
||||
|
||||
@ -90,6 +90,9 @@ def _is_ip_address(address: Any) -> bool:
|
||||
# According to the docs for socket.send it can raise
|
||||
# WantX509LookupError and should be retried.
|
||||
BLOCKING_IO_ERRORS = (_SSL.WantReadError, _SSL.WantWriteError, _SSL.WantX509LookupError)
|
||||
BLOCKING_IO_READ_ERROR = _SSL.WantReadError
|
||||
BLOCKING_IO_WRITE_ERROR = _SSL.WantWriteError
|
||||
BLOCKING_IO_LOOKUP_ERROR = _SSL.WantX509LookupError
|
||||
|
||||
|
||||
def _ragged_eof(exc: BaseException) -> bool:
|
||||
|
||||
@ -30,6 +30,8 @@ IS_PYOPENSSL = False
|
||||
|
||||
# Errors raised by SSL sockets when in non-blocking mode.
|
||||
BLOCKING_IO_ERRORS = (_ssl.SSLWantReadError, _ssl.SSLWantWriteError)
|
||||
BLOCKING_IO_READ_ERROR = _ssl.SSLWantReadError
|
||||
BLOCKING_IO_WRITE_ERROR = _ssl.SSLWantWriteError
|
||||
|
||||
# Base Exception class
|
||||
SSLError = _ssl.SSLError
|
||||
|
||||
@ -53,6 +53,9 @@ if HAVE_SSL:
|
||||
IPADDR_SAFE = True
|
||||
SSLError = _ssl.SSLError
|
||||
BLOCKING_IO_ERRORS = _ssl.BLOCKING_IO_ERRORS
|
||||
BLOCKING_IO_READ_ERROR = _ssl.BLOCKING_IO_READ_ERROR
|
||||
BLOCKING_IO_WRITE_ERROR = _ssl.BLOCKING_IO_WRITE_ERROR
|
||||
BLOCKING_IO_LOOKUP_ERROR = BLOCKING_IO_READ_ERROR
|
||||
|
||||
def get_ssl_context(
|
||||
certfile: Optional[str],
|
||||
|
||||
@ -728,9 +728,9 @@ class ClientContext:
|
||||
|
||||
def require_failCommand_appName(self, func):
|
||||
"""Run a test only if the server supports the failCommand appName."""
|
||||
# SERVER-47195
|
||||
# SERVER-47195 and SERVER-49336.
|
||||
return self._require(
|
||||
lambda: (self.test_commands_enabled and self.version >= (4, 4, -1)),
|
||||
lambda: (self.test_commands_enabled and self.version >= (4, 4, 7)),
|
||||
"failCommand appName must be supported",
|
||||
func=func,
|
||||
)
|
||||
|
||||
@ -730,9 +730,9 @@ class AsyncClientContext:
|
||||
|
||||
def require_failCommand_appName(self, func):
|
||||
"""Run a test only if the server supports the failCommand appName."""
|
||||
# SERVER-47195
|
||||
# SERVER-47195 and SERVER-49336.
|
||||
return self._require(
|
||||
lambda: (self.test_commands_enabled and self.version >= (4, 4, -1)),
|
||||
lambda: (self.test_commands_enabled and self.version >= (4, 4, 7)),
|
||||
"failCommand appName must be supported",
|
||||
func=func,
|
||||
)
|
||||
|
||||
@ -22,7 +22,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"connectionId": 1,
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedIn",
|
||||
@ -32,7 +33,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"connectionId": 1,
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -23,12 +23,14 @@
|
||||
{
|
||||
"type": "ConnectionReady",
|
||||
"connectionId": 1,
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"connectionId": 1,
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -38,7 +38,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"address": 42,
|
||||
"connectionId": 42
|
||||
"connectionId": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedIn",
|
||||
@ -56,6 +57,7 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"address": 42,
|
||||
"duration": 42,
|
||||
"reason": "poolClosed"
|
||||
}
|
||||
],
|
||||
|
||||
@ -89,7 +89,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "timeout",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -59,7 +59,8 @@
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckOutStarted",
|
||||
@ -76,17 +77,20 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "connectionError",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "connectionError",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "connectionError",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
],
|
||||
"closeConnection": false,
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 1000
|
||||
"blockTimeMS": 10000
|
||||
}
|
||||
},
|
||||
"poolOptions": {
|
||||
|
||||
@ -40,7 +40,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"address": 42,
|
||||
"connectionId": 42
|
||||
"connectionId": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionPoolCleared",
|
||||
@ -49,6 +50,7 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"address": 42,
|
||||
"duration": 42,
|
||||
"reason": "connectionError"
|
||||
},
|
||||
{
|
||||
@ -57,7 +59,8 @@
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "connectionError",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionPoolReady",
|
||||
@ -47,7 +48,8 @@
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
|
||||
@ -48,7 +48,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckedOut",
|
||||
"connectionId": 42,
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckOutStarted",
|
||||
@ -57,7 +58,8 @@
|
||||
{
|
||||
"type": "ConnectionCheckOutFailed",
|
||||
"reason": "timeout",
|
||||
"address": 42
|
||||
"address": 42,
|
||||
"duration": 42
|
||||
},
|
||||
{
|
||||
"type": "ConnectionCheckedIn",
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -104,7 +104,7 @@
|
||||
"aggregate"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 55
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,7 +114,7 @@
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"pipeline": [],
|
||||
"timeoutMS": 50
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
@ -242,7 +242,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 150
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,7 +252,7 @@
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"pipeline": [],
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 200,
|
||||
"batchSize": 2,
|
||||
"maxAwaitTimeMS": 1
|
||||
},
|
||||
@ -310,7 +310,7 @@
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"pipeline": [],
|
||||
"timeoutMS": 20
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"saveResultAsEntity": "changeStream"
|
||||
},
|
||||
@ -330,7 +330,7 @@
|
||||
"aggregate"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 12,
|
||||
"blockTimeMS": 120,
|
||||
"errorCode": 7,
|
||||
"errorLabels": [
|
||||
"ResumableChangeStreamError"
|
||||
@ -412,7 +412,7 @@
|
||||
"arguments": {
|
||||
"pipeline": [],
|
||||
"maxAwaitTimeMS": 1,
|
||||
"timeoutMS": 100
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"saveResultAsEntity": "changeStream"
|
||||
},
|
||||
@ -431,7 +431,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 150
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -544,7 +544,7 @@
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"pipeline": [],
|
||||
"timeoutMS": 10
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"saveResultAsEntity": "changeStream"
|
||||
},
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 50
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"batchSize": 2,
|
||||
"timeoutMS": 20
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"saveResultAsEntity": "cursor"
|
||||
},
|
||||
@ -175,7 +175,7 @@
|
||||
"killCursors"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 30
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"batchSize": 2,
|
||||
"timeoutMS": 20
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"saveResultAsEntity": "cursor"
|
||||
},
|
||||
@ -194,7 +194,7 @@
|
||||
"name": "close",
|
||||
"object": "cursor",
|
||||
"arguments": {
|
||||
"timeoutMS": 40
|
||||
"timeoutMS": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -215,7 +215,7 @@
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"killCursors": "collection",
|
||||
"killCursors": "coll",
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
"schemaVersion": "1.9",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9",
|
||||
"minServerVersion": "4.4.7",
|
||||
"topologies": [
|
||||
"single",
|
||||
"replicaset",
|
||||
"sharded-replicaset",
|
||||
"sharded"
|
||||
],
|
||||
"serverless": "forbid"
|
||||
@ -52,7 +51,7 @@
|
||||
],
|
||||
"appName": "reduceMaxTimeMSTest",
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 75
|
||||
"blockTimeMS": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -21,7 +21,7 @@
|
||||
"client": {
|
||||
"id": "client",
|
||||
"uriOptions": {
|
||||
"timeoutMS": 50
|
||||
"timeoutMS": 500
|
||||
},
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
@ -81,6 +81,9 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectError": {
|
||||
"isClientError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -109,7 +112,7 @@
|
||||
"insert"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 30
|
||||
"blockTimeMS": 300
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,6 +185,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "abortTransaction",
|
||||
"databaseName": "admin",
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.2",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
{
|
||||
"minServerVersion": "4.2",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"description": "legacy timeouts continue to work if timeoutMS is not set",
|
||||
"schemaVersion": "1.9",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.4"
|
||||
@ -280,7 +280,7 @@
|
||||
{
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"client": {
|
||||
"id": "client",
|
||||
"uriOptions": {
|
||||
"timeoutMS": 10
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
@ -84,7 +84,7 @@
|
||||
"find"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 125
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,7 +153,7 @@
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 200,
|
||||
"batchSize": 2
|
||||
},
|
||||
"expectError": {
|
||||
@ -221,7 +221,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 150
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"timeoutMode": "cursorLifetime",
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 200,
|
||||
"batchSize": 2
|
||||
},
|
||||
"expectError": {
|
||||
@ -299,7 +299,7 @@
|
||||
"find"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,7 +355,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 125
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -366,7 +366,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"timeoutMode": "iteration",
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 200,
|
||||
"batchSize": 2
|
||||
}
|
||||
}
|
||||
@ -427,7 +427,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -21,7 +21,7 @@
|
||||
"client": {
|
||||
"id": "client",
|
||||
"uriOptions": {
|
||||
"timeoutMS": 50
|
||||
"timeoutMS": 500
|
||||
},
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
@ -78,7 +78,7 @@
|
||||
"commitTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@
|
||||
"abortTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@
|
||||
"insert"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,6 +302,26 @@
|
||||
"commandFailedEvent": {
|
||||
"commandName": "insert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "abortTransaction",
|
||||
"databaseName": "admin",
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandFailedEvent": {
|
||||
"commandName": "abortTransaction"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -75,7 +75,7 @@
|
||||
"commitTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@
|
||||
"name": "commitTransaction",
|
||||
"object": "session",
|
||||
"arguments": {
|
||||
"timeoutMS": 50
|
||||
"timeoutMS": 500
|
||||
},
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
@ -165,7 +165,7 @@
|
||||
"abortTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@
|
||||
"name": "abortTransaction",
|
||||
"object": "session",
|
||||
"arguments": {
|
||||
"timeoutMS": 50
|
||||
"timeoutMS": 500
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -252,7 +252,7 @@
|
||||
"insert"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@
|
||||
"name": "withTransaction",
|
||||
"object": "session",
|
||||
"arguments": {
|
||||
"timeoutMS": 50,
|
||||
"timeoutMS": 500,
|
||||
"callback": [
|
||||
{
|
||||
"name": "insertOne",
|
||||
@ -306,6 +306,26 @@
|
||||
"commandFailedEvent": {
|
||||
"commandName": "insert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "abortTransaction",
|
||||
"databaseName": "admin",
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandFailedEvent": {
|
||||
"commandName": "abortTransaction"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"minServerVersion": "4.4",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
"sharded-replicaset"
|
||||
"sharded"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -47,7 +47,7 @@
|
||||
"id": "session",
|
||||
"client": "client",
|
||||
"sessionOptions": {
|
||||
"defaultTimeoutMS": 50
|
||||
"defaultTimeoutMS": 500
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@
|
||||
"commitTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@
|
||||
"abortTransaction"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@
|
||||
"insert"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
"blockTimeMS": 600
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,6 +302,26 @@
|
||||
"commandFailedEvent": {
|
||||
"commandName": "insert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "abortTransaction",
|
||||
"databaseName": "admin",
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandFailedEvent": {
|
||||
"commandName": "abortTransaction"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"client": {
|
||||
"id": "client",
|
||||
"uriOptions": {
|
||||
"timeoutMS": 10
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
@ -130,7 +130,7 @@
|
||||
"find"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 300
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 150
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"cursorType": "tailableAwait",
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 250,
|
||||
"batchSize": 1
|
||||
},
|
||||
"saveResultAsEntity": "tailableCursor"
|
||||
@ -272,7 +272,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 150
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"cursorType": "tailableAwait",
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 250,
|
||||
"batchSize": 1,
|
||||
"maxAwaitTimeMS": 1
|
||||
},
|
||||
@ -354,7 +354,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"client": {
|
||||
"id": "client",
|
||||
"uriOptions": {
|
||||
"timeoutMS": 10
|
||||
"timeoutMS": 200
|
||||
},
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
@ -94,7 +94,7 @@
|
||||
"find"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 150
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"cursorType": "tailable",
|
||||
"timeoutMS": 20,
|
||||
"timeoutMS": 200,
|
||||
"batchSize": 1
|
||||
},
|
||||
"saveResultAsEntity": "tailableCursor"
|
||||
@ -239,7 +239,7 @@
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 15
|
||||
"blockTimeMS": 250
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9",
|
||||
"minServerVersion": "4.4.7",
|
||||
"serverless": "forbid",
|
||||
"topologies": [
|
||||
"single",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9",
|
||||
"minServerVersion": "4.4.7",
|
||||
"serverless": "forbid",
|
||||
"topologies": [
|
||||
"single",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"schemaVersion": "1.11",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9",
|
||||
"minServerVersion": "4.4",
|
||||
"serverless": "forbid",
|
||||
"topologies": [
|
||||
"replicaset",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9",
|
||||
"minServerVersion": "4.4.7",
|
||||
"serverless": "forbid",
|
||||
"topologies": [
|
||||
"single"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"description": "cursors are correctly pinned to connections for load-balanced clusters",
|
||||
"schemaVersion": "1.3",
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"topologies": [
|
||||
@ -222,7 +222,10 @@
|
||||
"reply": {
|
||||
"cursor": {
|
||||
"id": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"firstBatch": {
|
||||
"$$type": "array"
|
||||
@ -239,7 +242,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "coll0"
|
||||
},
|
||||
@ -333,7 +339,10 @@
|
||||
"reply": {
|
||||
"cursor": {
|
||||
"id": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"firstBatch": {
|
||||
"$$type": "array"
|
||||
@ -475,7 +484,10 @@
|
||||
"reply": {
|
||||
"cursor": {
|
||||
"id": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"firstBatch": {
|
||||
"$$type": "array"
|
||||
@ -492,7 +504,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "coll0"
|
||||
},
|
||||
@ -605,7 +620,10 @@
|
||||
"reply": {
|
||||
"cursor": {
|
||||
"id": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"firstBatch": {
|
||||
"$$type": "array"
|
||||
@ -750,7 +768,10 @@
|
||||
"reply": {
|
||||
"cursor": {
|
||||
"id": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"firstBatch": {
|
||||
"$$type": "array"
|
||||
@ -767,7 +788,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "coll0"
|
||||
},
|
||||
@ -858,7 +882,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "coll0"
|
||||
},
|
||||
@ -950,7 +977,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": {
|
||||
"$$type": "string"
|
||||
@ -1100,7 +1130,10 @@
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": "long"
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "coll0"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"description": "state change errors are correctly handled",
|
||||
"schemaVersion": "1.3",
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"topologies": [
|
||||
@ -263,7 +263,7 @@
|
||||
"description": "errors during the initial connection hello are ignored",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.9"
|
||||
"minServerVersion": "4.4.7"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
@ -279,7 +279,6 @@
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"ismaster",
|
||||
"isMaster",
|
||||
"hello"
|
||||
],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"description": "transactions are correctly pinned to connections for load-balanced clusters",
|
||||
"schemaVersion": "1.3",
|
||||
"schemaVersion": "1.4",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"topologies": [
|
||||
|
||||
@ -413,7 +413,7 @@ class TestPooling(_TestPoolingBase):
|
||||
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
|
||||
print(len(pool.conns))
|
||||
|
||||
@client_context.require_failCommand_fail_point
|
||||
@client_context.require_failCommand_appName
|
||||
def test_csot_timeout_message(self):
|
||||
client = rs_or_single_client(appName="connectionTimeoutApp")
|
||||
self.addCleanup(client.close)
|
||||
@ -438,7 +438,7 @@ class TestPooling(_TestPoolingBase):
|
||||
|
||||
self.assertTrue("(configured timeouts: timeoutMS: 500.0ms" in str(error.exception))
|
||||
|
||||
@client_context.require_failCommand_fail_point
|
||||
@client_context.require_failCommand_appName
|
||||
def test_socket_timeout_message(self):
|
||||
client = rs_or_single_client(socketTimeoutMS=500, appName="connectionTimeoutApp")
|
||||
self.addCleanup(client.close)
|
||||
@ -465,10 +465,7 @@ class TestPooling(_TestPoolingBase):
|
||||
in str(error.exception)
|
||||
)
|
||||
|
||||
@client_context.require_failCommand_fail_point
|
||||
@client_context.require_version_min(
|
||||
4, 9, 0
|
||||
) # configureFailPoint does not allow failure on handshake before 4.9, fixed in SERVER-49336
|
||||
@client_context.require_failCommand_appName
|
||||
def test_connection_timeout_message(self):
|
||||
# Mock a connection creation failing due to timeout.
|
||||
mock_connection_timeout = {
|
||||
|
||||
@ -141,7 +141,6 @@ class TestStreamingProtocol(IntegrationTest):
|
||||
self.assertEqual(1, len(events))
|
||||
self.assertGreater(events[0].new_description.round_trip_time, 0)
|
||||
|
||||
@client_context.require_version_min(4, 9, -1)
|
||||
@client_context.require_failCommand_appName
|
||||
def test_monitor_waits_after_server_check_error(self):
|
||||
# This test implements:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user