Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4739

Async TestEncryptedBulkWrite should use AsyncBulkTestBase

    • Type: Icon: Build Failure Build Failure
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.9
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      test.asynchronous.test_encryption.TestEncryptedBulkWrite.test_upsert_uuid_standard_encrypt fails on 4.0:

       [2024/09/05 15:32:25.242] FAILURE: pymongo.errors.ConfigurationError: Auto-encryption requires a minimum MongoDB version of 4.2 ()
       [2024/09/05 15:32:25.242] self = <test.asynchronous.test_encryption.TestEncryptedBulkWrite testMethod=test_upsert_uuid_standard_encrypt>
       [2024/09/05 15:32:25.242]     async def test_upsert_uuid_standard_encrypt(self):
       [2024/09/05 15:32:25.242]         opts = AutoEncryptionOpts(KMS_PROVIDERS, "keyvault.datakeys")
       [2024/09/05 15:32:25.242]         client = await async_rs_or_single_client(auto_encryption_opts=opts)
       [2024/09/05 15:32:25.242]         self.addAsyncCleanup(client.aclose)
       [2024/09/05 15:32:25.242]     
       [2024/09/05 15:32:25.242]         options = CodecOptions(uuid_representation=UuidRepresentation.STANDARD)
       [2024/09/05 15:32:25.242]         encrypted_coll = client.pymongo_test.test
       [2024/09/05 15:32:25.242]         coll = encrypted_coll.with_options(codec_options=options)
       [2024/09/05 15:32:25.242]         uuids = [uuid.uuid4() for _ in range(3)]
       [2024/09/05 15:32:25.242] >       result = await coll.bulk_write(
       [2024/09/05 15:32:25.242]             [
       [2024/09/05 15:32:25.242]                 UpdateOne({"_id": uuids[0]}, {"$set": {"a": 0}}, upsert=True),
       [2024/09/05 15:32:25.242]                 ReplaceOne({"a": 1}, {"_id": uuids[1]}, upsert=True),
       [2024/09/05 15:32:25.242]                 # This is just here to make the counts right in all cases.
       [2024/09/05 15:32:25.242]                 ReplaceOne({"_id": uuids[2]}, {"_id": uuids[2]}, upsert=True),
       [2024/09/05 15:32:25.242]             ]
       [2024/09/05 15:32:25.242]         )
       [2024/09/05 15:32:25.242] test\asynchronous\test_encryption.py:385: 
       [2024/09/05 15:32:25.242] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2024/09/05 15:32:25.242] pymongo\_csot.py:110: in csot_wrapper
       [2024/09/05 15:32:25.242]     return await func(self, *args, **kwargs)
       [2024/09/05 15:32:25.242] pymongo\asynchronous\collection.py:769: in bulk_write
       [2024/09/05 15:32:25.242]     bulk_api_result = await blk.execute(write_concern, session, _Op.INSERT)
       [2024/09/05 15:32:25.242] pymongo\asynchronous\bulk.py:742: in execute
       [2024/09/05 15:32:25.242]     return await self.execute_command(generator, write_concern, session, operation)
       [2024/09/05 15:32:25.242] pymongo\asynchronous\bulk.py:597: in execute_command
       [2024/09/05 15:32:25.242]     _ = await client._retryable_write(
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:1877: in _retryable_write
       [2024/09/05 15:32:25.242]     return await self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:1763: in _retry_with_session
       [2024/09/05 15:32:25.242]     return await self._retry_internal(
       [2024/09/05 15:32:25.242] pymongo\_csot.py:110: in csot_wrapper
       [2024/09/05 15:32:25.242]     return await func(self, *args, **kwargs)
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:1798: in _retry_internal
       [2024/09/05 15:32:25.242]     return await _ClientConnectionRetryable(
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:2539: in run
       [2024/09/05 15:32:25.242]     return await self._read() if self._is_read else await self._write()
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:2648: in _write
       [2024/09/05 15:32:25.242]     async with self._client._checkout(self._server, self._session) as conn:
       [2024/09/05 15:32:25.242] C:\python\Python310\lib\contextlib.py:199: in __aenter__
       [2024/09/05 15:32:25.242]     return await anext(self.gen)
       [2024/09/05 15:32:25.242] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2024/09/05 15:32:25.242] self = AsyncMongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, tls=True, tlscertificate... replicaset='repl0', auto_encryption_opts=<pymongo.encryption_options.AutoEncryptionOpts object at 0x000001EFFED480A0>)
       [2024/09/05 15:32:25.242] server = <Server <ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None>>
       [2024/09/05 15:32:25.242] session = <pymongo.asynchronous.client_session.AsyncClientSession object at 0x000001EFFED4B3D0>
       [2024/09/05 15:32:25.242]     @contextlib.asynccontextmanager
       [2024/09/05 15:32:25.242]     async def _checkout(
       [2024/09/05 15:32:25.242]         self, server: Server, session: Optional[AsyncClientSession]
       [2024/09/05 15:32:25.242]     ) -> AsyncGenerator[AsyncConnection, None]:
       [2024/09/05 15:32:25.242]         in_txn = session and session.in_transaction
       [2024/09/05 15:32:25.242]         async with _MongoClientErrorHandler(self, server, session) as err_handler:
       [2024/09/05 15:32:25.242]             # Reuse the pinned connection, if it exists.
       [2024/09/05 15:32:25.242]             if in_txn and session and session._pinned_connection:
       [2024/09/05 15:32:25.242]                 err_handler.contribute_socket(session._pinned_connection)
       [2024/09/05 15:32:25.242]                 yield session._pinned_connection
       [2024/09/05 15:32:25.242]                 return
       [2024/09/05 15:32:25.242]             async with await server.checkout(handler=err_handler) as conn:
       [2024/09/05 15:32:25.242]                 # Pin this session to the selected server or connection.
       [2024/09/05 15:32:25.242]                 if (
       [2024/09/05 15:32:25.242]                     in_txn
       [2024/09/05 15:32:25.242]                     and session
       [2024/09/05 15:32:25.242]                     and server.description.server_type
       [2024/09/05 15:32:25.242]                     in (
       [2024/09/05 15:32:25.242]                         SERVER_TYPE.Mongos,
       [2024/09/05 15:32:25.242]                         SERVER_TYPE.LoadBalancer,
       [2024/09/05 15:32:25.242]                     )
       [2024/09/05 15:32:25.242]                 ):
       [2024/09/05 15:32:25.242]                     session._pin(server, conn)
       [2024/09/05 15:32:25.242]                 err_handler.contribute_socket(conn)
       [2024/09/05 15:32:25.242]                 if (
       [2024/09/05 15:32:25.242]                     self._encrypter
       [2024/09/05 15:32:25.242]                     and not self._encrypter._bypass_auto_encryption
       [2024/09/05 15:32:25.242]                     and conn.max_wire_version < 8
       [2024/09/05 15:32:25.242]                 ):
       [2024/09/05 15:32:25.242] >                   raise ConfigurationError(
       [2024/09/05 15:32:25.242]                         "Auto-encryption requires a minimum MongoDB version of 4.2"
       [2024/09/05 15:32:25.242]                     )
       [2024/09/05 15:32:25.242] E                   pymongo.errors.ConfigurationError: Auto-encryption requires a minimum MongoDB version of 4.2
       [2024/09/05 15:32:25.242] pymongo\asynchronous\mongo_client.py:1590: ConfigurationError
      

      https://spruce.mongodb.com/task/mongo_python_driver_tests_windows_encryption__platform~windows_64_vsMulti_small_auth_ssl~auth_ssl_python_version_windows~3.10_encryption~encryption_crypt_shared_test_4.0_replica_set_29bbf77dad0867ca19bf9769ca3fddc19cadec23_24_09_05_21_18_48?execution=0&sortBy=STATUS&sortDir=ASC

      The sync version of the test is correctly skipped. Caused by PYTHON-4673.

            Assignee:
            noah.stapp@mongodb.com Noah Stapp
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: