From 06ff9cec94d7ac7f8538a96e2e754fb4f9738929 Mon Sep 17 00:00:00 2001 From: Iris Date: Tue, 1 Sep 2026 10:22:50 -0700 Subject: [PATCH 1/2] update prose test --- test/asynchronous/test_encryption.py | 16 +++++++--------- test/test_encryption.py | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 0628e736fa..780c794c52 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -2236,6 +2236,11 @@ async def asyncSetUp(self): await self.db.command( "create", "explicit_encryption", encryptedFields=self.encrypted_fields ) + self.encrypted_fields_c10 = json_data("etc", "data", "encryptedFields-c10.json") + await self.client.drop_database(self.client.explicit_encryption_c10) + await self.db.command( + "create", "explicit_encryption_c10", encryptedFields=self.encrypted_fields_c10 + ) key_vault = await create_key_vault(self.client.keyvault.datakeys, self.key1_document) self.addCleanup(key_vault.drop) self.key_vault_client = self.client @@ -2271,20 +2276,13 @@ async def test_01_insert_encrypted_indexed_and_find(self): self.assertEqual(docs[0]["encryptedIndexed"], val) async def test_02_insert_encrypted_indexed_and_find_contention(self): - # setUp creates the collection with contention=0 (from encryptedFields.json). - # This test uses contention_factor=10, so recreate the collection with contention=10. - await self.db.drop_collection("explicit_encryption", encrypted_fields=self.encrypted_fields) - encrypted_fields = copy.deepcopy(self.encrypted_fields) - encrypted_fields["fields"][0]["queries"]["contention"] = 10 - await self.db.command("create", "explicit_encryption", encryptedFields=encrypted_fields) - val = "encrypted indexed value" contention = 10 for _ in range(contention): insert_payload = await self.client_encryption.encrypt( val, Algorithm.INDEXED, self.key1_id, contention_factor=contention ) - await self.encrypted_client[self.db.name].explicit_encryption.insert_one( + await self.encrypted_client[self.db.name].explicit_encryption_c10.insert_one( {"encryptedIndexed": insert_payload} ) @@ -2298,7 +2296,7 @@ async def test_02_insert_encrypted_indexed_and_find_contention(self): ) docs = ( await self.encrypted_client[self.db.name] - .explicit_encryption.find({"encryptedIndexed": find_payload}) + .explicit_encryption_c10.find({"encryptedIndexed": find_payload}) .to_list() ) diff --git a/test/test_encryption.py b/test/test_encryption.py index 036d394a1a..93e62efa98 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -2224,6 +2224,11 @@ def setUp(self): self.db = self.client.test_queryable_encryption self.client.drop_database(self.db) self.db.command("create", "explicit_encryption", encryptedFields=self.encrypted_fields) + self.encrypted_fields_c10 = json_data("etc", "data", "encryptedFields-c10.json") + self.client.drop_database(self.client.explicit_encryption_c10) + self.db.command( + "create", "explicit_encryption_c10", encryptedFields=self.encrypted_fields_c10 + ) key_vault = create_key_vault(self.client.keyvault.datakeys, self.key1_document) self.addCleanup(key_vault.drop) self.key_vault_client = self.client @@ -2259,20 +2264,13 @@ def test_01_insert_encrypted_indexed_and_find(self): self.assertEqual(docs[0]["encryptedIndexed"], val) def test_02_insert_encrypted_indexed_and_find_contention(self): - # setUp creates the collection with contention=0 (from encryptedFields.json). - # This test uses contention_factor=10, so recreate the collection with contention=10. - self.db.drop_collection("explicit_encryption", encrypted_fields=self.encrypted_fields) - encrypted_fields = copy.deepcopy(self.encrypted_fields) - encrypted_fields["fields"][0]["queries"]["contention"] = 10 - self.db.command("create", "explicit_encryption", encryptedFields=encrypted_fields) - val = "encrypted indexed value" contention = 10 for _ in range(contention): insert_payload = self.client_encryption.encrypt( val, Algorithm.INDEXED, self.key1_id, contention_factor=contention ) - self.encrypted_client[self.db.name].explicit_encryption.insert_one( + self.encrypted_client[self.db.name].explicit_encryption_c10.insert_one( {"encryptedIndexed": insert_payload} ) @@ -2286,7 +2284,7 @@ def test_02_insert_encrypted_indexed_and_find_contention(self): ) docs = ( self.encrypted_client[self.db.name] - .explicit_encryption.find({"encryptedIndexed": find_payload}) + .explicit_encryption_c10.find({"encryptedIndexed": find_payload}) .to_list() ) From 4ddd5fc06737ce3674387b302a94d650c2a194e2 Mon Sep 17 00:00:00 2001 From: Iris Date: Tue, 1 Sep 2026 15:27:03 -0700 Subject: [PATCH 2/2] copilot review --- test/asynchronous/test_encryption.py | 1 - test/test_encryption.py | 1 - 2 files changed, 2 deletions(-) diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 780c794c52..6b62ce837c 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -2237,7 +2237,6 @@ async def asyncSetUp(self): "create", "explicit_encryption", encryptedFields=self.encrypted_fields ) self.encrypted_fields_c10 = json_data("etc", "data", "encryptedFields-c10.json") - await self.client.drop_database(self.client.explicit_encryption_c10) await self.db.command( "create", "explicit_encryption_c10", encryptedFields=self.encrypted_fields_c10 ) diff --git a/test/test_encryption.py b/test/test_encryption.py index 93e62efa98..9821409839 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -2225,7 +2225,6 @@ def setUp(self): self.client.drop_database(self.db) self.db.command("create", "explicit_encryption", encryptedFields=self.encrypted_fields) self.encrypted_fields_c10 = json_data("etc", "data", "encryptedFields-c10.json") - self.client.drop_database(self.client.explicit_encryption_c10) self.db.command( "create", "explicit_encryption_c10", encryptedFields=self.encrypted_fields_c10 )