diff options
author | Benety Goh <benety@mongodb.com> | 2021-12-13 12:15:08 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-13 17:46:29 +0000 |
commit | 886e09ce457d5cdbef16710678c386ec6765db3c (patch) | |
tree | cabe4bb339af9e1b8f8b552cec0eb80f4b7cd253 /src/mongo/logv2 | |
parent | c8de2a7f419f2486780fed5ae06ade4e78aa2a5d (diff) | |
download | mongo-886e09ce457d5cdbef16710678c386ec6765db3c.tar.gz |
SERVER-61846 redact document using null instead of default mask to stay under BSON limit
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r-- | src/mongo/logv2/redaction_test.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/logv2/redaction_test.cpp b/src/mongo/logv2/redaction_test.cpp index 8ab293822c2..bc22f60b4ae 100644 --- a/src/mongo/logv2/redaction_test.cpp +++ b/src/mongo/logv2/redaction_test.cpp @@ -155,7 +155,7 @@ TEST(RedactBSONTest, BSONWithArrays) { testBSONCases(testCases); } -TEST(RedactBSONTest, RedactCausesBSONTooLarge) { +TEST(RedactBSONTest, RedactedObjectShouldBeSmallerOrEqualInSizeToOriginal) { logv2::setShouldRedactLogs(true); BSONObjBuilder bob; for (int i = 0; i < 1024 * 1024; i++) { @@ -164,8 +164,8 @@ TEST(RedactBSONTest, RedactCausesBSONTooLarge) { bob.append(fieldName, 1); } const auto obj = bob.obj(); - // Demonstrates it is possible to grow a BSON too large by redacting fields. - ASSERT_THROWS_CODE(redact(obj), DBException, ErrorCodes::BSONObjectTooLarge); + const auto redactedObj = redact(obj); + ASSERT_LTE(redactedObj.objsize(), obj.objsize()); } } // namespace } // namespace mongo |