summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-12-13 12:15:08 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-13 17:46:29 +0000
commit886e09ce457d5cdbef16710678c386ec6765db3c (patch)
treecabe4bb339af9e1b8f8b552cec0eb80f4b7cd253 /src/mongo/logv2
parentc8de2a7f419f2486780fed5ae06ade4e78aa2a5d (diff)
downloadmongo-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.cpp6
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