Skip to content

Commit 29df415

Browse files
authored
PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests (#1584)
1 parent 74595a1 commit 29df415

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

test/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@
129129
}
130130
KMIP_CREDS = {"endpoint": os.environ.get("FLE_KMIP_ENDPOINT", "localhost:5698")}
131131

132+
os.environ[
133+
"MONGOB_LOG_MAX_DOCUMENT_LENGTH"
134+
] = "2000" # Ensure Evergreen metadata doesn't result in truncation
135+
132136

133137
def is_server_resolvable():
134138
"""Returns True if 'server' is resolvable."""

test/test_command_logging.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
# Location of JSON test specifications.
2727
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "command_logging")
2828

29-
os.environ["MONGOB_LOG_MAX_DOCUMENT_LENGTH"] = "2000"
30-
3129
globals().update(
3230
generate_test_classes(
3331
_TEST_PATH,

test/unified_format.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,15 +1770,16 @@ def check_log_messages(self, operations, spec):
17701770
def format_logs(log_list):
17711771
client_to_log = defaultdict(list)
17721772
for log in log_list:
1773-
data = json_util.loads(log.message)
1774-
client = data.pop("clientId")
1775-
client_to_log[client].append(
1776-
{
1777-
"level": log.levelname.lower(),
1778-
"component": log.name.replace("pymongo.", "", 1),
1779-
"data": data,
1780-
}
1781-
)
1773+
if log.module != "ocsp_support":
1774+
data = json_util.loads(log.message)
1775+
client = data.pop("clientId")
1776+
client_to_log[client].append(
1777+
{
1778+
"level": log.levelname.lower(),
1779+
"component": log.name.replace("pymongo.", "", 1),
1780+
"data": data,
1781+
}
1782+
)
17821783
return client_to_log
17831784

17841785
with self.assertLogs("pymongo", level="DEBUG") as cm:

0 commit comments

Comments
 (0)