PYTHON-4980 Ignore network error on killAllSessions (#2011)
This commit is contained in:
parent
ddf783b69a
commit
b5f0104048
@ -76,6 +76,7 @@ from pymongo.asynchronous.encryption import AsyncClientEncryption
|
||||
from pymongo.asynchronous.helpers import anext
|
||||
from pymongo.encryption_options import _HAVE_PYMONGOCRYPT
|
||||
from pymongo.errors import (
|
||||
AutoReconnect,
|
||||
BulkWriteError,
|
||||
ClientBulkWriteException,
|
||||
ConfigurationError,
|
||||
@ -755,9 +756,10 @@ class UnifiedSpecTestMixinV1(AsyncIntegrationTest):
|
||||
for client in clients:
|
||||
try:
|
||||
await client.admin.command("killAllSessions", [])
|
||||
except OperationFailure:
|
||||
except (OperationFailure, AutoReconnect):
|
||||
# "operation was interrupted" by killing the command's
|
||||
# own session.
|
||||
# On 8.0+ killAllSessions sometimes returns a network error.
|
||||
pass
|
||||
|
||||
async def _databaseOperation_listCollections(self, target, *args, **kwargs):
|
||||
|
||||
@ -46,7 +46,7 @@ from gridfs.asynchronous.grid_file import AsyncGridFSBucket
|
||||
from pymongo.asynchronous import client_session
|
||||
from pymongo.asynchronous.command_cursor import AsyncCommandCursor
|
||||
from pymongo.asynchronous.cursor import AsyncCursor
|
||||
from pymongo.errors import BulkWriteError, OperationFailure, PyMongoError
|
||||
from pymongo.errors import AutoReconnect, BulkWriteError, OperationFailure, PyMongoError
|
||||
from pymongo.read_concern import ReadConcern
|
||||
from pymongo.read_preferences import ReadPreference
|
||||
from pymongo.results import BulkWriteResult, _WriteResult
|
||||
@ -343,9 +343,10 @@ class AsyncSpecRunner(AsyncIntegrationTest):
|
||||
for client in clients:
|
||||
try:
|
||||
await client.admin.command("killAllSessions", [])
|
||||
except OperationFailure:
|
||||
except (OperationFailure, AutoReconnect):
|
||||
# "operation was interrupted" by killing the command's
|
||||
# own session.
|
||||
# On 8.0+ killAllSessions sometimes returns a network error.
|
||||
pass
|
||||
|
||||
def check_command_result(self, expected_result, result):
|
||||
|
||||
@ -69,6 +69,7 @@ from gridfs import GridFSBucket, GridOut
|
||||
from pymongo import ASCENDING, CursorType, MongoClient, _csot
|
||||
from pymongo.encryption_options import _HAVE_PYMONGOCRYPT
|
||||
from pymongo.errors import (
|
||||
AutoReconnect,
|
||||
BulkWriteError,
|
||||
ClientBulkWriteException,
|
||||
ConfigurationError,
|
||||
@ -751,9 +752,10 @@ class UnifiedSpecTestMixinV1(IntegrationTest):
|
||||
for client in clients:
|
||||
try:
|
||||
client.admin.command("killAllSessions", [])
|
||||
except OperationFailure:
|
||||
except (OperationFailure, AutoReconnect):
|
||||
# "operation was interrupted" by killing the command's
|
||||
# own session.
|
||||
# On 8.0+ killAllSessions sometimes returns a network error.
|
||||
pass
|
||||
|
||||
def _databaseOperation_listCollections(self, target, *args, **kwargs):
|
||||
|
||||
@ -43,7 +43,7 @@ from bson.int64 import Int64
|
||||
from bson.son import SON
|
||||
from gridfs import GridFSBucket
|
||||
from gridfs.synchronous.grid_file import GridFSBucket
|
||||
from pymongo.errors import BulkWriteError, OperationFailure, PyMongoError
|
||||
from pymongo.errors import AutoReconnect, BulkWriteError, OperationFailure, PyMongoError
|
||||
from pymongo.read_concern import ReadConcern
|
||||
from pymongo.read_preferences import ReadPreference
|
||||
from pymongo.results import BulkWriteResult, _WriteResult
|
||||
@ -343,9 +343,10 @@ class SpecRunner(IntegrationTest):
|
||||
for client in clients:
|
||||
try:
|
||||
client.admin.command("killAllSessions", [])
|
||||
except OperationFailure:
|
||||
except (OperationFailure, AutoReconnect):
|
||||
# "operation was interrupted" by killing the command's
|
||||
# own session.
|
||||
# On 8.0+ killAllSessions sometimes returns a network error.
|
||||
pass
|
||||
|
||||
def check_command_result(self, expected_result, result):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user