Skip to content

Commit bc7181c

Browse files
authored
PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests cleanup (#1585)
1 parent 29df415 commit bc7181c

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

test/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@
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
132+
# Ensure Evergreen metadata doesn't result in truncation
133+
os.environ.setdefault("MONGOB_LOG_MAX_DOCUMENT_LENGTH", "2000")
135134

136135

137136
def is_server_resolvable():

test/unified_format.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,16 +1770,17 @@ 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-
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-
)
1773+
if log.module == "ocsp_support":
1774+
continue
1775+
data = json_util.loads(log.message)
1776+
client = data.pop("clientId")
1777+
client_to_log[client].append(
1778+
{
1779+
"level": log.levelname.lower(),
1780+
"component": log.name.replace("pymongo.", "", 1),
1781+
"data": data,
1782+
}
1783+
)
17831784
return client_to_log
17841785

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

0 commit comments

Comments
 (0)