From 29df4159edee158d68abf1db632919d5215157a5 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Fri, 12 Apr 2024 16:15:54 -0700 Subject: [PATCH] PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests (#1584) --- test/__init__.py | 4 ++++ test/test_command_logging.py | 2 -- test/unified_format.py | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index fc20f68df..503113492 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -129,6 +129,10 @@ GCP_CREDS = { } KMIP_CREDS = {"endpoint": os.environ.get("FLE_KMIP_ENDPOINT", "localhost:5698")} +os.environ[ + "MONGOB_LOG_MAX_DOCUMENT_LENGTH" +] = "2000" # Ensure Evergreen metadata doesn't result in truncation + def is_server_resolvable(): """Returns True if 'server' is resolvable.""" diff --git a/test/test_command_logging.py b/test/test_command_logging.py index 7f1effedd..9b2d52e66 100644 --- a/test/test_command_logging.py +++ b/test/test_command_logging.py @@ -26,8 +26,6 @@ from test.unified_format import generate_test_classes # Location of JSON test specifications. _TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "command_logging") -os.environ["MONGOB_LOG_MAX_DOCUMENT_LENGTH"] = "2000" - globals().update( generate_test_classes( _TEST_PATH, diff --git a/test/unified_format.py b/test/unified_format.py index 4ae37353c..e06f1aa0f 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -1770,15 +1770,16 @@ class UnifiedSpecTestMixinV1(IntegrationTest): def format_logs(log_list): client_to_log = defaultdict(list) for log in log_list: - data = json_util.loads(log.message) - client = data.pop("clientId") - client_to_log[client].append( - { - "level": log.levelname.lower(), - "component": log.name.replace("pymongo.", "", 1), - "data": data, - } - ) + if log.module != "ocsp_support": + data = json_util.loads(log.message) + client = data.pop("clientId") + client_to_log[client].append( + { + "level": log.levelname.lower(), + "component": log.name.replace("pymongo.", "", 1), + "data": data, + } + ) return client_to_log with self.assertLogs("pymongo", level="DEBUG") as cm: