From f24811407040442e2b38eb94d7d25c71f14fa84a Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Thu, 4 Nov 2021 10:34:50 -0700 Subject: [PATCH 01/11] PYTHON-2459 Implement unified gridfs tests --- test/unified_format.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/unified_format.py b/test/unified_format.py index d36b5d0a48..626da80e28 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -910,6 +910,8 @@ def maybe_skip_test(self, spec): if not client_context.test_commands_enabled: if name == "failPoint" or name == "targetedFailPoint": self.skipTest("Test commands must be enabled to use fail points") + if "timeoutMode" in op.get("arguments", {}): + self.skipTest("PyMongo does not support timeoutMode") if name == "modifyCollection": self.skipTest("PyMongo does not support modifyCollection") if "timeoutMode" in op.get("arguments", {}): @@ -920,12 +922,6 @@ def maybe_skip_test(self, spec): if name == "createEntities": self.maybe_skip_entity(op.get("arguments", {}).get("entities", [])) - def maybe_skip_entity(self, entities): - for entity in entities: - entity_type = next(iter(entity)) - if entity_type == "bucket": - self.skipTest("GridFS is not currently supported (PYTHON-2459)") - def process_error(self, exception, spec): is_error = spec.get("isError") is_client_error = spec.get("isClientError") From 035bee02cff864640520583f55c2c861a2671c9e Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 13:02:29 -0700 Subject: [PATCH 02/11] PYTHON-2459 Keep skipping CSOT gridfs tests for now --- test/unified_format.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/unified_format.py b/test/unified_format.py index 626da80e28..d36b5d0a48 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -910,8 +910,6 @@ def maybe_skip_test(self, spec): if not client_context.test_commands_enabled: if name == "failPoint" or name == "targetedFailPoint": self.skipTest("Test commands must be enabled to use fail points") - if "timeoutMode" in op.get("arguments", {}): - self.skipTest("PyMongo does not support timeoutMode") if name == "modifyCollection": self.skipTest("PyMongo does not support modifyCollection") if "timeoutMode" in op.get("arguments", {}): @@ -922,6 +920,12 @@ def maybe_skip_test(self, spec): if name == "createEntities": self.maybe_skip_entity(op.get("arguments", {}).get("entities", [])) + def maybe_skip_entity(self, entities): + for entity in entities: + entity_type = next(iter(entity)) + if entity_type == "bucket": + self.skipTest("GridFS is not currently supported (PYTHON-2459)") + def process_error(self, exception, spec): is_error = spec.get("isError") is_client_error = spec.get("isClientError") From 0e81cdec54a35ac91deade1976ca409a7120d61c Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 13:41:22 -0700 Subject: [PATCH 03/11] PYTHON-3362 Ignore wtimeout and maxTimeMS when timeoutMS or timeout() is configured --- pymongo/_csot.py | 15 ++++++++++++++- pymongo/bulk.py | 5 ++--- pymongo/collection.py | 8 -------- pymongo/network.py | 5 ++--- pymongo/pool.py | 9 +-------- test/unified_format.py | 11 ----------- 6 files changed, 19 insertions(+), 34 deletions(-) diff --git a/pymongo/_csot.py b/pymongo/_csot.py index e25bba108f..5170c0d8ca 100644 --- a/pymongo/_csot.py +++ b/pymongo/_csot.py @@ -17,7 +17,9 @@ import functools import time from contextvars import ContextVar, Token -from typing import Any, Callable, Optional, Tuple, TypeVar, cast +from typing import Any, Callable, MutableMapping, Optional, Tuple, TypeVar, cast + +from pymongo.write_concern import WriteConcern TIMEOUT: ContextVar[Optional[float]] = ContextVar("TIMEOUT", default=None) RTT: ContextVar[float] = ContextVar("RTT", default=0.0) @@ -103,3 +105,14 @@ def csot_wrapper(self, *args, **kwargs): return func(self, *args, **kwargs) return cast(F, csot_wrapper) + + +def apply_write_concern(cmd: MutableMapping, write_concern: Optional[WriteConcern]) -> None: + """Apply the given write concern to a command.""" + if not write_concern or write_concern.is_server_default: + return + wc = write_concern.document + if get_timeout() is not None: + wc.pop("wtimeout", None) + if wc: + cmd["writeConcern"] = wc diff --git a/pymongo/bulk.py b/pymongo/bulk.py index 7992383f67..b21b576aa5 100644 --- a/pymongo/bulk.py +++ b/pymongo/bulk.py @@ -23,7 +23,7 @@ from bson.objectid import ObjectId from bson.raw_bson import RawBSONDocument from bson.son import SON -from pymongo import common +from pymongo import _csot, common from pymongo.client_session import _validate_session_write_concern from pymongo.collation import validate_collation_or_none from pymongo.common import ( @@ -315,8 +315,7 @@ def _execute_command( cmd = SON([(cmd_name, self.collection.name), ("ordered", self.ordered)]) if self.comment: cmd["comment"] = self.comment - if not write_concern.is_server_default: - cmd["writeConcern"] = write_concern.document + _csot.apply_write_concern(cmd, write_concern) if self.bypass_doc_val: cmd["bypassDocumentValidation"] = True if self.let is not None and run.op_type in (_DELETE, _UPDATE): diff --git a/pymongo/collection.py b/pymongo/collection.py index 22af5a6426..9a9ba56618 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -542,8 +542,6 @@ def _insert_one( command = SON([("insert", self.name), ("ordered", ordered), ("documents", [doc])]) if comment is not None: command["comment"] = comment - if not write_concern.is_server_default: - command["writeConcern"] = write_concern.document def _insert_command(session, sock_info, retryable_write): if bypass_doc_val: @@ -756,8 +754,6 @@ def _update( if let is not None: common.validate_is_mapping("let", let) command["let"] = let - if not write_concern.is_server_default: - command["writeConcern"] = write_concern.document if comment is not None: command["comment"] = comment @@ -1232,8 +1228,6 @@ def _delete( hint = helpers._index_document(hint) delete_doc["hint"] = hint command = SON([("delete", self.name), ("ordered", ordered), ("deletes", [delete_doc])]) - if not write_concern.is_server_default: - command["writeConcern"] = write_concern.document if let is not None: common.validate_is_document_type("let", let) @@ -2820,8 +2814,6 @@ def _find_and_modify(session, sock_info, retryable_write): "Must be connected to MongoDB 4.4+ to use hint on unacknowledged find and modify commands." ) cmd["hint"] = hint - if not write_concern.is_server_default: - cmd["writeConcern"] = write_concern.document out = self._command( sock_info, cmd, diff --git a/pymongo/network.py b/pymongo/network.py index 3eac0d02d3..a5c5459e14 100644 --- a/pymongo/network.py +++ b/pymongo/network.py @@ -118,9 +118,8 @@ def command( # Support CSOT if client: - sock_info.apply_timeout(client, spec, write_concern) - elif write_concern and not write_concern.is_server_default: - spec["writeConcern"] = write_concern.document + sock_info.apply_timeout(client, spec) + _csot.apply_write_concern(spec, write_concern) if use_op_msg: flags = _OpMsg.MORE_TO_COME if unacknowledged else 0 diff --git a/pymongo/pool.py b/pymongo/pool.py index ed9feac918..1fab98209f 100644 --- a/pymongo/pool.py +++ b/pymongo/pool.py @@ -569,16 +569,13 @@ def set_socket_timeout(self, timeout): self.last_timeout = timeout self.sock.settimeout(timeout) - def apply_timeout(self, client, cmd, write_concern=None): + def apply_timeout(self, client, cmd): # CSOT: use remaining timeout when set. timeout = _csot.remaining() if timeout is None: # Reset the socket timeout unless we're performing a streaming monitor check. if not self.more_to_come: self.set_socket_timeout(self.opts.socket_timeout) - - if cmd and write_concern and not write_concern.is_server_default: - cmd["writeConcern"] = write_concern.document return None # RTT validation. rtt = _csot.get_rtt() @@ -593,10 +590,6 @@ def apply_timeout(self, client, cmd, write_concern=None): ) if cmd is not None: cmd["maxTimeMS"] = int(max_time_ms * 1000) - wc = write_concern.document if write_concern else {} - wc.pop("wtimeout", None) - if wc: - cmd["writeConcern"] = wc self.set_socket_timeout(timeout) return timeout diff --git a/test/unified_format.py b/test/unified_format.py index d36b5d0a48..d71b47fee0 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -914,17 +914,6 @@ def maybe_skip_test(self, spec): self.skipTest("PyMongo does not support modifyCollection") if "timeoutMode" in op.get("arguments", {}): self.skipTest("PyMongo does not support timeoutMode") - if "csot" in class_name: - if "bucket" in op["object"]: - self.skipTest("CSOT not implemented for GridFS") - if name == "createEntities": - self.maybe_skip_entity(op.get("arguments", {}).get("entities", [])) - - def maybe_skip_entity(self, entities): - for entity in entities: - entity_type = next(iter(entity)) - if entity_type == "bucket": - self.skipTest("GridFS is not currently supported (PYTHON-2459)") def process_error(self, exception, spec): is_error = spec.get("isError") From af94995bd9e166592de8ad4d9b29b5deb93601fe Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 14:17:58 -0700 Subject: [PATCH 04/11] PYTHON-3362 Increase test timeouts for gridfs ops --- test/csot/gridfs-advanced.json | 4 ++-- test/csot/gridfs-delete.json | 2 +- test/csot/gridfs-download.json | 2 +- test/csot/gridfs-find.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/csot/gridfs-advanced.json b/test/csot/gridfs-advanced.json index 668b93f37a..0ca23b660a 100644 --- a/test/csot/gridfs-advanced.json +++ b/test/csot/gridfs-advanced.json @@ -129,7 +129,7 @@ "$oid": "000000000000000000000005" }, "newFilename": "foo", - "timeoutMS": 100 + "timeoutMS": 2000 } } ], @@ -243,7 +243,7 @@ "name": "drop", "object": "bucket", "arguments": { - "timeoutMS": 100 + "timeoutMS": 2000 } } ] diff --git a/test/csot/gridfs-delete.json b/test/csot/gridfs-delete.json index f458fa827c..d393a9c794 100644 --- a/test/csot/gridfs-delete.json +++ b/test/csot/gridfs-delete.json @@ -128,7 +128,7 @@ "id": { "$oid": "000000000000000000000005" }, - "timeoutMS": 100 + "timeoutMS": 1000 } } ] diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index a3044a6d81..0786c2e882 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -128,7 +128,7 @@ "id": { "$oid": "000000000000000000000005" }, - "timeoutMS": 100 + "timeoutMS": 1000 } } ] diff --git a/test/csot/gridfs-find.json b/test/csot/gridfs-find.json index f75a279c01..0954ed3940 100644 --- a/test/csot/gridfs-find.json +++ b/test/csot/gridfs-find.json @@ -94,7 +94,7 @@ "object": "bucket", "arguments": { "filter": {}, - "timeoutMS": 100 + "timeoutMS": 1000 } } ], From afd738b5aee0d4b5127eb40dfea9eeab737e6ffb Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 14:45:04 -0700 Subject: [PATCH 05/11] PYTHON-3362 Apply csot timeout to GridFS operations --- gridfs/__init__.py | 8 +++++++- test/csot/gridfs-download.json | 18 ++++++++++++++++-- test/unified_format.py | 14 +++++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/gridfs/__init__.py b/gridfs/__init__.py index 08c7e1d2cd..6ab843a85e 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -33,7 +33,7 @@ _clear_entity_type_registry, _disallow_transactions, ) -from pymongo import ASCENDING, DESCENDING +from pymongo import ASCENDING, DESCENDING, _csot from pymongo.client_session import ClientSession from pymongo.collection import Collection from pymongo.common import validate_string @@ -514,6 +514,7 @@ def __init__( ) self._chunk_size_bytes = chunk_size_bytes + self._timeout = db.client.options.timeout def open_upload_stream( self, @@ -631,6 +632,7 @@ def open_upload_stream_with_id( return GridIn(self._collection, session=session, **opts) + @_csot.apply def upload_from_stream( self, filename: str, @@ -679,6 +681,7 @@ def upload_from_stream( return cast(ObjectId, gin._id) + @_csot.apply def upload_from_stream_with_id( self, file_id: Any, @@ -762,6 +765,7 @@ def open_download_stream( gout._ensure_file() return gout + @_csot.apply def download_to_stream( self, file_id: Any, destination: Any, session: Optional[ClientSession] = None ) -> None: @@ -795,6 +799,7 @@ def download_to_stream( for chunk in gout: destination.write(chunk) + @_csot.apply def delete(self, file_id: Any, session: Optional[ClientSession] = None) -> None: """Given an file_id, delete this stored file's files collection document and associated chunks from a GridFS bucket. @@ -926,6 +931,7 @@ def open_download_stream_by_name( except StopIteration: raise NoFile("no version %d for filename %r" % (revision, filename)) + @_csot.apply def download_to_stream_by_name( self, filename: str, diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index 0786c2e882..1dbdca2589 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -62,12 +62,11 @@ "_id": { "$oid": "000000000000000000000005" }, - "length": 10, + "length": 8, "chunkSize": 4, "uploadDate": { "$date": "1970-01-01T00:00:00.000Z" }, - "md5": "57d83cd477bfb1ccd975ab33d827a92b", "filename": "length-10", "contentType": "application/octet-stream", "aliases": [], @@ -93,6 +92,21 @@ "subType": "00" } } + }, + { + "_id": { + "$oid": "000000000000000000000006" + }, + "files_id": { + "$oid": "000000000000000000000005" + }, + "n": 1, + "data": { + "$binary": { + "base64": "ESIzRA==", + "subType": "00" + } + } } ] } diff --git a/test/unified_format.py b/test/unified_format.py index d71b47fee0..8e2a4c4dd7 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -52,7 +52,7 @@ snake_to_camel, ) from test.version import Version -from typing import Any +from typing import Any, List import pymongo from bson import SON, Code, DBRef, Decimal128, Int64, MaxKey, MinKey, json_util @@ -60,7 +60,7 @@ from bson.codec_options import DEFAULT_CODEC_OPTIONS from bson.objectid import ObjectId from bson.regex import RE_TYPE, Regex -from gridfs import GridFSBucket +from gridfs import GridFSBucket, GridOut from pymongo import ASCENDING, MongoClient from pymongo.change_stream import ChangeStream from pymongo.client_session import ClientSession, TransactionOptions, _TxnState @@ -871,8 +871,11 @@ def maybe_skip_test(self, spec): or "Dirty implicit session is discarded" in spec["description"] ): self.skipTest("MMAPv1 does not support retryWrites=True") - elif "Client side error in command starting transaction" in spec["description"]: + if "Client side error in command starting transaction" in spec["description"]: self.skipTest("Implement PYTHON-1894") + if "timeoutMS applied to entire download" in spec["description"]: + self.skipTest("PyMongo's open_download_stream does not cap the stream's lifetime") + class_name = self.__class__.__name__.lower() description = spec["description"].lower() if "csot" in class_name: @@ -1139,6 +1142,11 @@ def _bucketOperation_drop(self, target: GridFSBucket, *args: Any, **kwargs: Any) target._files.drop(*args, **kwargs) target._chunks.drop(*args, **kwargs) + def _bucketOperation_find( + self, target: GridFSBucket, *args: Any, **kwargs: Any + ) -> List[GridOut]: + return list(target.find(*args, **kwargs)) + def run_entity_operation(self, spec): target = self.entity_map[spec["object"]] opname = spec["name"] From eba38032f40b79193f363c559045d161b568a60a Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 15:19:53 -0700 Subject: [PATCH 06/11] PYTHON-3362 Fix gridfs initialData --- test/csot/gridfs-advanced.json | 20 +++++++++++++++++--- test/csot/gridfs-delete.json | 20 +++++++++++++++++--- test/csot/gridfs-download.json | 2 +- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/test/csot/gridfs-advanced.json b/test/csot/gridfs-advanced.json index 0ca23b660a..3a55b41d4b 100644 --- a/test/csot/gridfs-advanced.json +++ b/test/csot/gridfs-advanced.json @@ -62,13 +62,12 @@ "_id": { "$oid": "000000000000000000000005" }, - "length": 10, + "length": 8, "chunkSize": 4, "uploadDate": { "$date": "1970-01-01T00:00:00.000Z" }, - "md5": "57d83cd477bfb1ccd975ab33d827a92b", - "filename": "length-10", + "filename": "length-8", "contentType": "application/octet-stream", "aliases": [], "metadata": {} @@ -93,6 +92,21 @@ "subType": "00" } } + }, + { + "_id": { + "$oid": "000000000000000000000006" + }, + "files_id": { + "$oid": "000000000000000000000005" + }, + "n": 1, + "data": { + "$binary": { + "base64": "ESIzRA==", + "subType": "00" + } + } } ] } diff --git a/test/csot/gridfs-delete.json b/test/csot/gridfs-delete.json index d393a9c794..458c2c56ff 100644 --- a/test/csot/gridfs-delete.json +++ b/test/csot/gridfs-delete.json @@ -62,13 +62,12 @@ "_id": { "$oid": "000000000000000000000005" }, - "length": 10, + "length": 8, "chunkSize": 4, "uploadDate": { "$date": "1970-01-01T00:00:00.000Z" }, - "md5": "57d83cd477bfb1ccd975ab33d827a92b", - "filename": "length-10", + "filename": "length-8", "contentType": "application/octet-stream", "aliases": [], "metadata": {} @@ -93,6 +92,21 @@ "subType": "00" } } + }, + { + "_id": { + "$oid": "000000000000000000000006" + }, + "files_id": { + "$oid": "000000000000000000000005" + }, + "n": 1, + "data": { + "$binary": { + "base64": "ESIzRA==", + "subType": "00" + } + } } ] } diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index 1dbdca2589..7254a9c0a1 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -67,7 +67,7 @@ "uploadDate": { "$date": "1970-01-01T00:00:00.000Z" }, - "filename": "length-10", + "filename": "length-8", "contentType": "application/octet-stream", "aliases": [], "metadata": {} From 22fe667f7b51d856f2af583436e357075bdcac82 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 15:29:47 -0700 Subject: [PATCH 07/11] PYTHON-3362 Fix mock Gridfs drop tests --- test/unified_format.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/test/unified_format.py b/test/unified_format.py index 8e2a4c4dd7..9c7481e2e2 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -61,7 +61,7 @@ from bson.objectid import ObjectId from bson.regex import RE_TYPE, Regex from gridfs import GridFSBucket, GridOut -from pymongo import ASCENDING, MongoClient +from pymongo import ASCENDING, MongoClient, _csot from pymongo.change_stream import ChangeStream from pymongo.client_session import ClientSession, TransactionOptions, _TxnState from pymongo.collection import Collection @@ -460,7 +460,17 @@ def _create_entity(self, entity_spec, uri=None): elif entity_type == "bucket": db = self[spec["database"]] kwargs = parse_spec_options(spec.get("bucketOptions", {}).copy()) - self[spec["id"]] = GridFSBucket(db, **kwargs) + bucket = GridFSBucket(db, **kwargs) + + # PyMongo does not support GridFSBucket.drop(), emulate it. + @_csot.apply + def drop(self, *args: Any, **kwargs: Any) -> None: + self._files.drop(*args, **kwargs) + self._chunks.drop(*args, **kwargs) + + if not hasattr(bucket, "drop"): + bucket.drop = drop.__get__(bucket) + self[spec["id"]] = bucket return elif entity_type == "clientEncryption": opts = camel_to_snake_args(spec["clientEncryptionOpts"].copy()) @@ -1137,11 +1147,6 @@ def _bucketOperation_uploadWithId(self, target: GridFSBucket, *args: Any, **kwar kwargs.setdefault("metadata", {})["contentType"] = kwargs.pop("content_type") return target.upload_from_stream_with_id(*args, **kwargs) - def _bucketOperation_drop(self, target: GridFSBucket, *args: Any, **kwargs: Any) -> None: - # PyMongo does not support GridFSBucket.drop(), emulate it. - target._files.drop(*args, **kwargs) - target._chunks.drop(*args, **kwargs) - def _bucketOperation_find( self, target: GridFSBucket, *args: Any, **kwargs: Any ) -> List[GridOut]: From b3731e91502d5db9c3b856d0fdd23e5adabeea85 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 15:36:37 -0700 Subject: [PATCH 08/11] PYTHON-3362 Increse more gridfs test timeouts --- test/csot/gridfs-advanced.json | 10 +++++----- test/csot/gridfs-delete.json | 6 +++--- test/csot/gridfs-download.json | 6 +++--- test/csot/gridfs-find.json | 4 ++-- test/csot/gridfs-upload.json | 16 ++++++++-------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/csot/gridfs-advanced.json b/test/csot/gridfs-advanced.json index 3a55b41d4b..a67fd7fa4b 100644 --- a/test/csot/gridfs-advanced.json +++ b/test/csot/gridfs-advanced.json @@ -130,7 +130,7 @@ "update" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -188,7 +188,7 @@ "update" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -248,7 +248,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -280,7 +280,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -334,7 +334,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } diff --git a/test/csot/gridfs-delete.json b/test/csot/gridfs-delete.json index 458c2c56ff..2432f900db 100644 --- a/test/csot/gridfs-delete.json +++ b/test/csot/gridfs-delete.json @@ -130,7 +130,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -165,7 +165,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -224,7 +224,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index 7254a9c0a1..bc8bbe4c1f 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -130,7 +130,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -165,7 +165,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -224,7 +224,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } diff --git a/test/csot/gridfs-find.json b/test/csot/gridfs-find.json index 0954ed3940..fcb3819553 100644 --- a/test/csot/gridfs-find.json +++ b/test/csot/gridfs-find.json @@ -84,7 +84,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -139,7 +139,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } diff --git a/test/csot/gridfs-upload.json b/test/csot/gridfs-upload.json index b0daeb2e42..f34654bd5e 100644 --- a/test/csot/gridfs-upload.json +++ b/test/csot/gridfs-upload.json @@ -81,7 +81,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -117,7 +117,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -155,7 +155,7 @@ "listIndexes" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -193,7 +193,7 @@ "createIndexes" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -231,7 +231,7 @@ "listIndexes" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -269,7 +269,7 @@ "createIndexes" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -307,7 +307,7 @@ "insert" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } @@ -345,7 +345,7 @@ "insert" ], "blockConnection": true, - "blockTimeMS": 55 + "blockTimeMS": 75 } } } From a6f52c15d15f6832e579fe3bb8f5564582253dac Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 15:37:35 -0700 Subject: [PATCH 09/11] PYTHON-3362 Fix mypy for unified tests --- test/unified_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unified_format.py b/test/unified_format.py index 9c7481e2e2..d81238c0ee 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -464,7 +464,7 @@ def _create_entity(self, entity_spec, uri=None): # PyMongo does not support GridFSBucket.drop(), emulate it. @_csot.apply - def drop(self, *args: Any, **kwargs: Any) -> None: + def drop(self: GridFSBucket, *args: Any, **kwargs: Any) -> None: self._files.drop(*args, **kwargs) self._chunks.drop(*args, **kwargs) From 6d022630f3ddab66c49632075755a11fe607b67c Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 16:45:29 -0700 Subject: [PATCH 10/11] PYTHON-3362 Increase gridfs timeouts from 55->100 to resolve windows flakes --- test/csot/gridfs-advanced.json | 10 +++++----- test/csot/gridfs-delete.json | 6 +++--- test/csot/gridfs-download.json | 6 +++--- test/csot/gridfs-find.json | 4 ++-- test/csot/gridfs-upload.json | 16 ++++++++-------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/csot/gridfs-advanced.json b/test/csot/gridfs-advanced.json index a67fd7fa4b..91baeafc26 100644 --- a/test/csot/gridfs-advanced.json +++ b/test/csot/gridfs-advanced.json @@ -130,7 +130,7 @@ "update" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -188,7 +188,7 @@ "update" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -248,7 +248,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -280,7 +280,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -334,7 +334,7 @@ "drop" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } diff --git a/test/csot/gridfs-delete.json b/test/csot/gridfs-delete.json index 2432f900db..6e50ec25df 100644 --- a/test/csot/gridfs-delete.json +++ b/test/csot/gridfs-delete.json @@ -130,7 +130,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -165,7 +165,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -224,7 +224,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index bc8bbe4c1f..6920479f86 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -130,7 +130,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -165,7 +165,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -224,7 +224,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } diff --git a/test/csot/gridfs-find.json b/test/csot/gridfs-find.json index fcb3819553..b853a77711 100644 --- a/test/csot/gridfs-find.json +++ b/test/csot/gridfs-find.json @@ -84,7 +84,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -139,7 +139,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } diff --git a/test/csot/gridfs-upload.json b/test/csot/gridfs-upload.json index f34654bd5e..f46a58628a 100644 --- a/test/csot/gridfs-upload.json +++ b/test/csot/gridfs-upload.json @@ -81,7 +81,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -117,7 +117,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -155,7 +155,7 @@ "listIndexes" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -193,7 +193,7 @@ "createIndexes" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -231,7 +231,7 @@ "listIndexes" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -269,7 +269,7 @@ "createIndexes" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -307,7 +307,7 @@ "insert" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } @@ -345,7 +345,7 @@ "insert" ], "blockConnection": true, - "blockTimeMS": 75 + "blockTimeMS": 100 } } } From 7ddc2b9c94fd51f953455e5a08a81253555f58b1 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 19 Jul 2022 17:18:01 -0700 Subject: [PATCH 11/11] PYTHON-3362 Increase timeouts for windows again --- test/csot/gridfs-advanced.json | 2 +- test/csot/gridfs-delete.json | 4 ++-- test/csot/gridfs-download.json | 4 ++-- test/csot/gridfs-find.json | 2 +- test/csot/gridfs-upload.json | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/csot/gridfs-advanced.json b/test/csot/gridfs-advanced.json index 91baeafc26..0b09684fc7 100644 --- a/test/csot/gridfs-advanced.json +++ b/test/csot/gridfs-advanced.json @@ -17,7 +17,7 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 50 + "timeoutMS": 75 }, "useMultipleMongoses": false, "observeEvents": [ diff --git a/test/csot/gridfs-delete.json b/test/csot/gridfs-delete.json index 6e50ec25df..8701929ff3 100644 --- a/test/csot/gridfs-delete.json +++ b/test/csot/gridfs-delete.json @@ -17,7 +17,7 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 50 + "timeoutMS": 75 }, "useMultipleMongoses": false, "observeEvents": [ @@ -261,7 +261,7 @@ "delete" ], "blockConnection": true, - "blockTimeMS": 30 + "blockTimeMS": 50 } } } diff --git a/test/csot/gridfs-download.json b/test/csot/gridfs-download.json index 6920479f86..2ab64010f8 100644 --- a/test/csot/gridfs-download.json +++ b/test/csot/gridfs-download.json @@ -17,7 +17,7 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 50 + "timeoutMS": 75 }, "useMultipleMongoses": false, "observeEvents": [ @@ -298,7 +298,7 @@ "find" ], "blockConnection": true, - "blockTimeMS": 30 + "blockTimeMS": 50 } } } diff --git a/test/csot/gridfs-find.json b/test/csot/gridfs-find.json index b853a77711..45bb7066d6 100644 --- a/test/csot/gridfs-find.json +++ b/test/csot/gridfs-find.json @@ -17,7 +17,7 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 50 + "timeoutMS": 75 }, "useMultipleMongoses": false, "observeEvents": [ diff --git a/test/csot/gridfs-upload.json b/test/csot/gridfs-upload.json index f46a58628a..690fdda77f 100644 --- a/test/csot/gridfs-upload.json +++ b/test/csot/gridfs-upload.json @@ -17,7 +17,7 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 50 + "timeoutMS": 75 }, "useMultipleMongoses": false } @@ -384,7 +384,7 @@ "listIndexes" ], "blockConnection": true, - "blockTimeMS": 30 + "blockTimeMS": 50 } } }