From 464b9768031e7379ea9cde24386d97958bd5c9f3 Mon Sep 17 00:00:00 2001 From: Cloud User Date: Thu, 9 Jul 2026 18:41:33 +0000 Subject: [PATCH] resyncing specs 07-09-2026 --- test/asynchronous/test_srv_polling.py | 9 +- .../data/encryptedFields-substring-ci-di.json | 6 +- .../encryptedFields-substring-preview.json | 33 ++ .../etc/data/encryptedFields-substring.json | 10 +- .../spec/unified/QE-Text-substring.json | 467 ++++++++++++++++++ .../unified/QE-Text-substringPreview.json | 86 +--- .../identical-hostnames-valid-four-parts.json | 8 - ...identical-hostnames-valid-three-parts.json | 8 - test/test_srv_polling.py | 9 +- test/utils_shared.py | 5 + 10 files changed, 524 insertions(+), 117 deletions(-) create mode 100644 test/client-side-encryption/etc/data/encryptedFields-substring-preview.json create mode 100644 test/client-side-encryption/spec/unified/QE-Text-substring.json delete mode 100644 test/srv_seedlist/replica-set/identical-hostnames-valid-four-parts.json delete mode 100644 test/srv_seedlist/replica-set/identical-hostnames-valid-three-parts.json diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 520d520c7b..17711e07d4 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -21,7 +21,6 @@ import time from typing import Any -from test.asynchronous.utils import flaky from test.utils_shared import FunctionCallRecorder sys.path[0:0] = [""] @@ -226,7 +225,6 @@ def response_callback(*args): await self.run_scenario(response_callback, False) - @flaky(reason="PYTHON-5500", max_runs=3) async def test_dns_failures_logging(self): from dns import exception @@ -237,6 +235,11 @@ def response_callback(*args): await self.run_scenario(response_callback, False) + await async_wait_until( + lambda: any("SRV monitor check failed" in r.getMessage() for r in cm.records), + "log the SRV monitor check failure", + ) + srv_failure_logs = [r for r in cm.records if "SRV monitor check failed" in r.getMessage()] self.assertEqual(len(srv_failure_logs), 1) @@ -270,14 +273,12 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. await self.assert_nodelist_change(response_final, client) - @flaky(reason="PYTHON-5315") async def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return [] await self._test_recover_from_initial(empty_seedlist) - @flaky(reason="PYTHON-5315") async def test_recover_from_initially_erroring_seedlist(self): def erroring_seedlist(): raise ConfigurationError diff --git a/test/client-side-encryption/etc/data/encryptedFields-substring-ci-di.json b/test/client-side-encryption/etc/data/encryptedFields-substring-ci-di.json index d6aadfb877..657faa5343 100644 --- a/test/client-side-encryption/etc/data/encryptedFields-substring-ci-di.json +++ b/test/client-side-encryption/etc/data/encryptedFields-substring-ci-di.json @@ -11,7 +11,7 @@ "bsonType": "string", "queries": [ { - "queryType": "substringPreview", + "queryType": "substring", "strMaxLength": { "$numberInt": "10" }, @@ -19,7 +19,7 @@ "$numberInt": "2" }, "strMaxQueryLength": { - "$numberInt": "10" + "$numberInt": "6" }, "contention": 0, "caseSensitive": false, @@ -28,4 +28,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json b/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json new file mode 100644 index 0000000000..a519edc627 --- /dev/null +++ b/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json @@ -0,0 +1,33 @@ +{ + "fields": [ + { + "keyId": { + "$binary": { + "base64": "EjRWeBI0mHYSNBI0VniQEg==", + "subType": "04" + } + }, + "path": "encryptedText", + "bsonType": "string", + "queries": [ + { + "queryType": "substringPreview", + "strMaxLength": { + "$numberInt": "10" + }, + "strMinQueryLength": { + "$numberInt": "2" + }, + "strMaxQueryLength": { + "$numberInt": "6" + }, + "contention": { + "$numberLong": "0" + }, + "caseSensitive": true, + "diacriticSensitive": true + } + ] + } + ] +} diff --git a/test/client-side-encryption/etc/data/encryptedFields-substring.json b/test/client-side-encryption/etc/data/encryptedFields-substring.json index d321a32c5c..5e80f4fc95 100644 --- a/test/client-side-encryption/etc/data/encryptedFields-substring.json +++ b/test/client-side-encryption/etc/data/encryptedFields-substring.json @@ -1,6 +1,6 @@ { - "fields": [ - { + "fields": [ + { "keyId": { "$binary": { "base64": "EjRWeBI0mHYSNBI0VniQEg==", @@ -11,7 +11,7 @@ "bsonType": "string", "queries": [ { - "queryType": "substringPreview", + "queryType": "substring", "strMaxLength": { "$numberInt": "10" }, @@ -19,7 +19,7 @@ "$numberInt": "2" }, "strMaxQueryLength": { - "$numberInt": "10" + "$numberInt": "6" }, "contention": { "$numberLong": "0" @@ -29,5 +29,5 @@ } ] } - ] + ] } diff --git a/test/client-side-encryption/spec/unified/QE-Text-substring.json b/test/client-side-encryption/spec/unified/QE-Text-substring.json new file mode 100644 index 0000000000..f42a297278 --- /dev/null +++ b/test/client-side-encryption/spec/unified/QE-Text-substring.json @@ -0,0 +1,467 @@ +{ + "description": "QE-Text-substring", + "schemaVersion": "1.25", + "runOnRequirements": [ + { + "minServerVersion": "9.0.0", + "topologies": [ + "replicaset", + "sharded", + "load-balanced" + ], + "csfle": { + "minLibmongocryptVersion": "1.20.0" + } + } + ], + "createEntities": [ + { + "client": { + "id": "client", + "autoEncryptOpts": { + "keyVaultNamespace": "keyvault.datakeys", + "kmsProviders": { + "local": { + "key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk" + } + } + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "db", + "client": "client", + "databaseName": "db" + } + }, + { + "collection": { + "id": "coll", + "database": "db", + "collectionName": "coll" + } + } + ], + "initialData": [ + { + "databaseName": "keyvault", + "collectionName": "datakeys", + "documents": [ + { + "_id": { + "$binary": { + "base64": "q83vqxI0mHYSNBI0VniQEg==", + "subType": "04" + } + }, + "keyMaterial": { + "$binary": { + "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", + "subType": "00" + } + }, + "creationDate": { + "$date": { + "$numberLong": "1648914851981" + } + }, + "updateDate": { + "$date": { + "$numberLong": "1648914851981" + } + }, + "status": { + "$numberInt": "0" + }, + "masterKey": { + "provider": "local" + } + } + ] + }, + { + "databaseName": "db", + "collectionName": "coll", + "documents": [], + "createOptions": { + "encryptedFields": { + "fields": [ + { + "keyId": { + "$binary": { + "base64": "q83vqxI0mHYSNBI0VniQEg==", + "subType": "04" + } + }, + "path": "encryptedText", + "bsonType": "string", + "queries": [ + { + "queryType": "substring", + "contention": { + "$numberLong": "0" + }, + "strMinQueryLength": { + "$numberLong": "3" + }, + "strMaxQueryLength": { + "$numberLong": "6" + }, + "strMaxLength": { + "$numberLong": "20" + }, + "caseSensitive": true, + "diacriticSensitive": true + } + ] + } + ] + } + } + } + ], + "tests": [ + { + "description": "Insert QE substring", + "operations": [ + { + "name": "insertOne", + "arguments": { + "document": { + "_id": 1, + "encryptedText": "foobar" + } + }, + "object": "coll" + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "command": { + "listCollections": 1, + "filter": { + "name": "coll" + } + }, + "commandName": "listCollections" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "datakeys", + "filter": { + "$or": [ + { + "_id": { + "$in": [ + { + "$binary": { + "base64": "q83vqxI0mHYSNBI0VniQEg==", + "subType": "04" + } + } + ] + } + }, + { + "keyAltNames": { + "$in": [] + } + } + ] + }, + "$db": "keyvault", + "readConcern": { + "level": "majority" + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 1, + "encryptedText": { + "$$type": "binData" + } + } + ], + "ordered": true + }, + "commandName": "insert" + } + } + ] + } + ] + }, + { + "description": "Query with matching $encStrContains", + "operations": [ + { + "name": "insertOne", + "arguments": { + "document": { + "_id": 1, + "encryptedText": "foobar" + } + }, + "object": "coll" + }, + { + "name": "find", + "arguments": { + "filter": { + "$expr": { + "$encStrContains": { + "input": "$encryptedText", + "substring": "oba" + } + } + } + }, + "object": "coll", + "expectResult": [ + { + "_id": { + "$numberInt": "1" + }, + "encryptedText": "foobar", + "__safeContent__": [ + { + "$binary": { + "base64": "wpaMBVDjL4bHf9EtSP52PJFzyNn1R19+iNI/hWtvzdk=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "IpY3x/jjm8j/74jAdUhgxdM5hk68zR0zv/lTKm/72Vg=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "G+ky260C6QiOfIxKz14FmaMbAxvui1BKJO/TnLOHlGk=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "7dv3gAKe9vwJMZmpB40pRCwRTmc7ds9UkGhxH8j084E=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "o0V+Efn6x8XQdE80F1tztNaT3qxHjcsd9DOQ47BtmQk=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "sJvrCjyVot7PIZFsdRehWFANKAj6fmBaj3FLbz/dZLE=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "e98auxFmu02h5MfBIARk29MI7hSmvN3F9DaQ0xjqoEM=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "US83krGNov/ezL6IhsY5eEOCxv1xUPDIEL/nmY0IKi0=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "P2Aq5+OHZPG0CWIdmZvWq9c/18ZKVYW3vbxd+WU/TXU=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "8AdPRPnSzcd5uhq4TZfNvNeF0XjLNVwAsJJMTtktw84=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "9O6u/G51I4ZHFLhL4ZLuudbr0s202A2QnPfThmOXPhI=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "N7AjYVyVlv6+lVSTM+cIxRL3SMgs3G5LgxSs+jrgDkI=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "RbGF7dQbPGYQFd9DDO1hPz1UlLOJ77FAC6NsjGwJeos=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "m7srHMgKm6kZwsNx8rc45pmw0/9Qro6xuQ8lZS3+RYk=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "K75CNU3JyKFqZWPiIsVi4+n7DhYmcPl/nEhQ3d88mVI=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "c7bwGpUZc/7JzEnMS7qQ/TPuXZyrmMihFaAV6zIqbZc=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "rDvEdUgEk8u4Srt3ETokWs2FXcnyJaRGQ+NbkFwi2rQ=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "VcdZj9zfveRBRlpCR2OYWau2+GokOFb73TE3gpElNiU=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "eOa9o2xfA6OgkbYUxd6wQJicaeN6guhy2V66W3ALsaA=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "1xGkJh+um70XiRd8lKLDtyHgDqrf7/59Mg7X0+KZh8k=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "OSvllqHxycbcZN4phR6NDujY3ttA59o7nQJ6V9eJpX0=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "ZTX1pyk8Vdw0BSbJx7GeJNcQf3tGKxbrrNSTqBqUWkg=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "cn7V05zb5iXwYrePGMHztC+GRq+Tj8IMpRDraauPhSE=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "E9bV9KyrZxHJSUmMg0HrDK4gGN+75ruelAnrM6hXQgY=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "WrssTNmdgXoTGpbaF0JLRCGH6cDQuz1XEFNTy98nrb0=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "jZmyOJP35dsxQ/OY5U4ISpVRIYr8iedNfcwZiKt29Qc=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "d2mocORMbX9MX+/itAW8r1kxVw2/uii4vzXtc+2CIRQ=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "JBnJy58eRPhDo3DuZvsHbvQDiHXxdtAx1Eif66k5SfA=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "OjbDulC8s62v0pgweBSsQqtJjJBwH5JinfJpj7nVr+A=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "85i7KT2GP9nSda3Gsil5LKubhq0LDtc22pxBxHpR+nE=", + "subType": "00" + } + }, + { + "$binary": { + "base64": "u9Fvsclwrs9lwIcMPV/fMZD7L3d5anSfJQVjQb9mgLg=", + "subType": "00" + } + } + ] + } + ] + } + ] + }, + { + "description": "Query with non-matching $encStrContains", + "operations": [ + { + "name": "insertOne", + "arguments": { + "document": { + "_id": 1, + "encryptedText": "foobar" + } + }, + "object": "coll" + }, + { + "name": "find", + "arguments": { + "filter": { + "$expr": { + "$encStrContains": { + "input": "$encryptedText", + "substring": "blah" + } + } + } + }, + "object": "coll", + "expectResult": [] + } + ] + } + ] +} diff --git a/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json index 0cbfbbdfc6..1df3170958 100644 --- a/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json +++ b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json @@ -110,7 +110,7 @@ "$numberLong": "3" }, "strMaxQueryLength": { - "$numberLong": "10" + "$numberLong": "6" }, "strMaxLength": { "$numberLong": "20" @@ -427,90 +427,6 @@ "base64": "u9Fvsclwrs9lwIcMPV/fMZD7L3d5anSfJQVjQb9mgLg=", "subType": "00" } - }, - { - "$binary": { - "base64": "LZ32ttmLJGOIw9oFaUCn3Sx5uHPTYJPSFpeGRWNqlUc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mMsZvGEePTqtl0FJAL/jAdyWNQIlpwN61YIlZsSIZ6s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XZcu1a/ZGsIzAl3j4MXQlLo4v2p7kvIqRHtIQYFmL6k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Zse27LinlYCEnX6iTmJceI33mEJxFb0LdPxp0RiMOaQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vOv2Hgb2/sBpnX9XwFbIN6yDxhjchwlmczUf82W2tp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oQxZ9A6j3x5j6x1Jqw/N9tpP4rfWMjcV3y+a3PkrL7c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/D7ew3EijyUnmT22awVFspcuyo3JChJcDeCPwpljzVM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BEmmwqyamt9X3bcWDld61P01zquy8fBHAXq3SHAPP0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wygD9/kAo1KsRvtr1v+9/lvqoWdKwgh6gDHvAQfXPPk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pRTKgF/uksrF1c1AcfSTY6ZhqBKVud1vIztQ4/36SLs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C4iUo8oNJsjJ37BqnBgIgSQpf99X2Bb4W5MZEAmakHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "icoE53jIq6Fu/YGKUiSUTYyZ8xdiTQY9jJiGxVJObpw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oubCwk0V6G2RFWtcOnYDU4uUBoXBrhBRi4nZgrYj9JY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IyqhQ9nGhzEi5YW2W6v1kGU5DY2u2qSqbM/qXdLdWVU=", - "subType": "00" - } } ] } diff --git a/test/srv_seedlist/replica-set/identical-hostnames-valid-four-parts.json b/test/srv_seedlist/replica-set/identical-hostnames-valid-four-parts.json deleted file mode 100644 index b28a9276b1..0000000000 --- a/test/srv_seedlist/replica-set/identical-hostnames-valid-four-parts.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "uri": "mongodb+srv://test.build.10gen.cc/", - "seeds": [ - "test.build.10gen.cc:27017" - ], - "ping": false, - "comment": "Should not throw when SRV hostname and resolved hostname are identical and SRV hostname has four dot-separated parts." -} diff --git a/test/srv_seedlist/replica-set/identical-hostnames-valid-three-parts.json b/test/srv_seedlist/replica-set/identical-hostnames-valid-three-parts.json deleted file mode 100644 index 7a578ab4cc..0000000000 --- a/test/srv_seedlist/replica-set/identical-hostnames-valid-three-parts.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "uri": "mongodb+srv://build.10gen.cc/", - "seeds": [ - "build.10gen.cc:27017" - ], - "ping": false, - "comment": "Should not throw when SRV hostname and resolved hostname are identical and SRV hostname has three dot-separated parts." -} diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index f3d0c3f160..f297d6c6da 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -21,7 +21,6 @@ import time from typing import Any -from test.utils import flaky from test.utils_shared import FunctionCallRecorder sys.path[0:0] = [""] @@ -226,7 +225,6 @@ def response_callback(*args): self.run_scenario(response_callback, False) - @flaky(reason="PYTHON-5500", max_runs=3) def test_dns_failures_logging(self): from dns import exception @@ -237,6 +235,11 @@ def response_callback(*args): self.run_scenario(response_callback, False) + wait_until( + lambda: any("SRV monitor check failed" in r.getMessage() for r in cm.records), + "log the SRV monitor check failure", + ) + srv_failure_logs = [r for r in cm.records if "SRV monitor check failed" in r.getMessage()] self.assertEqual(len(srv_failure_logs), 1) @@ -270,14 +273,12 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. self.assert_nodelist_change(response_final, client) - @flaky(reason="PYTHON-5315") def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return [] self._test_recover_from_initial(empty_seedlist) - @flaky(reason="PYTHON-5315") def test_recover_from_initially_erroring_seedlist(self): def erroring_seedlist(): raise ConfigurationError diff --git a/test/utils_shared.py b/test/utils_shared.py index c0c811a5a7..62a3b4d406 100644 --- a/test/utils_shared.py +++ b/test/utils_shared.py @@ -351,6 +351,11 @@ def __call__(self, *args, **kwargs): else: return self._function(*args, **kwargs) + def __get__(self, obj, objtype=None): + if obj is None: + return self + return functools.partial(self, obj) + def reset(self): """Wipes the call list.""" self._call_list = []