Skip to content
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
1 change: 0 additions & 1 deletion .evergreen/remove-unimplemented-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ rm $PYMONGO/test/client-side-encryption/spec/unified/fle2v2-EncryptedFields-vs-E
rm $PYMONGO/test/client-side-encryption/spec/unified/localSchema.json # PYTHON-5143
rm $PYMONGO/test/client-side-encryption/spec/unified/maxWireVersion.json # PYTHON-5143
rm $PYMONGO/test/unified-test-format/valid-pass/poc-queryable-encryption.json # PYTHON-5143
rm $PYMONGO/test/gridfs/rename.json # PYTHON-4931
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.json # PYTHON-4918
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918
Expand Down
93 changes: 0 additions & 93 deletions .evergreen/spec-patch/PYTHON-4931.patch

This file was deleted.

3 changes: 3 additions & 0 deletions test/asynchronous/unified_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
from bson.codec_options import DEFAULT_CODEC_OPTIONS
from bson.objectid import ObjectId
from gridfs import AsyncGridFSBucket, GridOut, NoFile
from gridfs.errors import CorruptGridFile
from pymongo import ASCENDING, AsyncMongoClient, CursorType, _csot
from pymongo.asynchronous.change_stream import AsyncChangeStream
from pymongo.asynchronous.client_session import AsyncClientSession, TransactionOptions, _TxnState
Expand Down Expand Up @@ -613,6 +614,8 @@ def process_error(self, exception, spec):
# Connection errors are considered client errors.
if isinstance(error, ConnectionFailure):
self.assertNotIsInstance(error, NotPrimaryError)
elif isinstance(error, CorruptGridFile):
pass
elif isinstance(error, (InvalidOperation, ConfigurationError, EncryptionError, NoFile)):
pass
else:
Expand Down
4 changes: 2 additions & 2 deletions test/gridfs/delete.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
],
Expand Down Expand Up @@ -650,7 +650,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
],
Expand Down
10 changes: 5 additions & 5 deletions test/gridfs/download.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down Expand Up @@ -370,7 +370,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down Expand Up @@ -402,7 +402,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down Expand Up @@ -471,7 +471,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down Expand Up @@ -514,7 +514,7 @@
}
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions test/gridfs/downloadByName.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
"filename": "xyz"
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand All @@ -306,7 +306,7 @@
"revision": 999
},
"expectError": {
"isError": true
"isClientError": true
}
}
]
Expand Down
179 changes: 179 additions & 0 deletions test/gridfs/rename.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"description": "gridfs-rename",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "gridfs-tests"
}
},
{
"bucket": {
"id": "bucket0",
"database": "database0"
}
},
{
"collection": {
"id": "bucket0_files_collection",
"database": "database0",
"collectionName": "fs.files"
}
},
{
"collection": {
"id": "bucket0_chunks_collection",
"database": "database0",
"collectionName": "fs.chunks"
}
}
],
"initialData": [
{
"collectionName": "fs.files",
"databaseName": "gridfs-tests",
"documents": [
{
"_id": {
"$oid": "000000000000000000000001"
},
"length": 0,
"chunkSize": 4,
"uploadDate": {
"$date": "1970-01-01T00:00:00.000Z"
},
"filename": "filename",
"metadata": {}
},
{
"_id": {
"$oid": "000000000000000000000002"
},
"length": 0,
"chunkSize": 4,
"uploadDate": {
"$date": "1970-01-01T00:00:00.000Z"
},
"filename": "filename",
"metadata": {}
}
]
},
{
"collectionName": "fs.chunks",
"databaseName": "gridfs-tests",
"documents": [
{
"_id": {
"$oid": "000000000000000000000001"
},
"files_id": {
"$oid": "000000000000000000000002"
},
"n": 0,
"data": {
"$binary": {
"base64": "",
"subType": "00"
}
}
}
]
}
],
"tests": [
{
"description": "rename by id",
"operations": [
{
"name": "rename",
"object": "bucket0",
"arguments": {
"id": {
"$oid": "000000000000000000000001"
},
"newFilename": "newfilename"
}
}
],
"outcome": [
{
"collectionName": "fs.files",
"databaseName": "gridfs-tests",
"documents": [
{
"_id": {
"$oid": "000000000000000000000001"
},
"length": 0,
"chunkSize": 4,
"uploadDate": {
"$date": "1970-01-01T00:00:00.000Z"
},
"filename": "newfilename",
"metadata": {}
},
{
"_id": {
"$oid": "000000000000000000000002"
},
"length": 0,
"chunkSize": 4,
"uploadDate": {
"$date": "1970-01-01T00:00:00.000Z"
},
"filename": "filename",
"metadata": {}
}
]
},
{
"collectionName": "fs.chunks",
"databaseName": "gridfs-tests",
"documents": [
{
"_id": {
"$oid": "000000000000000000000001"
},
"files_id": {
"$oid": "000000000000000000000002"
},
"n": 0,
"data": {
"$binary": {
"base64": "",
"subType": "00"
}
}
}
]
}
]
},
{
"description": "rename when file id does not exist",
"operations": [
{
"name": "rename",
"object": "bucket0",
"arguments": {
"id": {
"$oid": "000000000000000000000003"
},
"newFilename": "newfilename"
},
"expectError": {
"isClientError": true
}
}
]
}
]
}
3 changes: 3 additions & 0 deletions test/unified_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from bson.codec_options import DEFAULT_CODEC_OPTIONS
from bson.objectid import ObjectId
from gridfs import GridFSBucket, GridOut, NoFile
from gridfs.errors import CorruptGridFile
from pymongo import ASCENDING, CursorType, MongoClient, _csot
from pymongo.driver_info import DriverInfo
from pymongo.encryption_options import _HAVE_PYMONGOCRYPT
Expand Down Expand Up @@ -612,6 +613,8 @@ def process_error(self, exception, spec):
# Connection errors are considered client errors.
if isinstance(error, ConnectionFailure):
self.assertNotIsInstance(error, NotPrimaryError)
elif isinstance(error, CorruptGridFile):
pass
elif isinstance(error, (InvalidOperation, ConfigurationError, EncryptionError, NoFile)):
pass
else:
Expand Down
Loading