PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests (#1584)

This commit is contained in:
Noah Stapp 2024-04-12 16:15:54 -07:00 committed by GitHub
parent 74595a1608
commit 29df4159ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 11 deletions

View File

@ -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."""

View File

@ -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,

View File

@ -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: