summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2021-06-24 11:33:53 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-24 16:41:57 +0000
commit3b8806bef0f65df11e4d49786bf962ce0dd6b4dd (patch)
tree377a530cbb5178839232ce0327af3d9fb90a6b13 /src/mongo/logv2
parent559331677f0c45596dd93d1f2b3feaa364333cb4 (diff)
downloadmongo-3b8806bef0f65df11e4d49786bf962ce0dd6b4dd.tar.gz
SERVER-57289 redact should not convert BSONArray into BSONObj
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r--src/mongo/logv2/redaction_test.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/logv2/redaction_test.cpp b/src/mongo/logv2/redaction_test.cpp
index c7db40ab768..e6feb6de33c 100644
--- a/src/mongo/logv2/redaction_test.cpp
+++ b/src/mongo/logv2/redaction_test.cpp
@@ -106,7 +106,6 @@ void testBSONCases(std::initializer_list<BSONStringPair> testCases) {
TEST(RedactBSONTest, BasicBSON) {
logv2::setShouldRedactLogs(true);
- std::vector<BSONStringPair> testCases;
testBSONCases({BSONStringPair(BSONObj(), "{}"),
BSONStringPair(BSON("" << 1), "{ : \"###\" }"),
@@ -122,7 +121,13 @@ TEST(RedactBSONTest, BasicBSON) {
<< "1"),
"{ a: \"###\", a: \"###\" }")});
}
-/*
+
+void testBSONCases(std::vector<BSONStringPair>& testCases) {
+ for (auto m : testCases) {
+ ASSERT_EQ(redact(m.first).toString(), m.second);
+ }
+}
+
TEST(RedactBSONTest, NestedBSON) {
logv2::setShouldRedactLogs(true);
std::vector<BSONStringPair> testCases;
@@ -134,7 +139,7 @@ TEST(RedactBSONTest, NestedBSON) {
testCases.push_back(BSONStringPair(BSON("a" << BSON("a" << 1)), "{ a: { a: \"###\" } }"));
testCases.push_back(BSONStringPair(BSON("a" << BSON("a" << 1 << "b" << 1)),
"{ a: { a: \"###\", b: \"###\" } }"));
- testBSONVector(testCases);
+ testBSONCases(testCases);
}
TEST(RedactBSONTest, BSONWithArrays) {
@@ -147,7 +152,7 @@ TEST(RedactBSONTest, BSONWithArrays) {
testCases.push_back(BSONStringPair(BSON("a" << BSON_ARRAY(BSON("a" << 1) << BSON("b" << 1))),
"{ a: [ { a: \"###\" }, { b: \"###\" } ] }"));
- testBSONVector(testCases);
-}*/
+ testBSONCases(testCases);
+}
} // namespace
} // namespace mongo