diff options
author | Richard Hausman <richard.hausman@mongodb.com> | 2022-08-19 17:55:53 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-19 19:31:00 +0000 |
commit | d3ea0605477301d4055034dde5153267a61eb5ab (patch) | |
tree | bc1fcfa4b804ce2b713ed69f3bbc13eab897a515 /src/mongo/db/update | |
parent | 9a07ecfd7e91d330fc4cf8ea8b08e2f2e75ec04e (diff) | |
download | mongo-d3ea0605477301d4055034dde5153267a61eb5ab.tar.gz |
SERVER-67880 : Check BSON column is decompressible in the validate command.
Diffstat (limited to 'src/mongo/db/update')
-rw-r--r-- | src/mongo/db/update/document_diff_calculator_test.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/update/document_diff_calculator_test.cpp b/src/mongo/db/update/document_diff_calculator_test.cpp index 55a05051021..feaeb9343be 100644 --- a/src/mongo/db/update/document_diff_calculator_test.cpp +++ b/src/mongo/db/update/document_diff_calculator_test.cpp @@ -32,6 +32,7 @@ #include <functional> #include "mongo/bson/bson_depth.h" +#include "mongo/bson/bson_validate.h" #include "mongo/bson/json.h" #include "mongo/db/update/document_diff_calculator.h" #include "mongo/unittest/unittest.h" @@ -295,7 +296,7 @@ TEST(DocumentDiffCalculatorTest, DeeplyNestObjectGenerateDiff) { preBob.append("largeField", largeValue); buildDeepObj(&preBob, "subObj", 0, maxDepth, functionToApply); auto preObj = preBob.done(); - ASSERT(preObj.valid()); + ASSERT_OK(validateBSON(preObj)); BSONObjBuilder postBob; postBob.append("largeField", largeValue); @@ -312,7 +313,7 @@ TEST(DocumentDiffCalculatorTest, DeeplyNestObjectGenerateDiff) { // Deleting the deepest field should give the post object. diffOutput = doc_diff::computeDiff(preObj, postBob2.done(), 0, nullptr); ASSERT(diffOutput); - ASSERT(diffOutput->diff.valid()); + ASSERT_OK(validateBSON(diffOutput->diff)); BSONObjBuilder expectedOutputBuilder; buildDeepObj(&expectedOutputBuilder, @@ -341,17 +342,17 @@ TEST(DocumentDiffCalculatorTest, DeepestObjectSubDiff) { value = 1; buildDeepObj(&bob1, "subObj", 0, BSONDepth::getMaxDepthForUserStorage(), functionToApply); auto preObj = bob1.done(); - ASSERT(preObj.valid()); + ASSERT_OK(validateBSON(preObj)); BSONObjBuilder postBob; value = 2; buildDeepObj(&postBob, "subObj", 0, BSONDepth::getMaxDepthForUserStorage(), functionToApply); auto postObj = postBob.done(); - ASSERT(postObj.valid()); + ASSERT_OK(validateBSON(postObj)); auto diffOutput = doc_diff::computeDiff(preObj, postObj, 0, nullptr); ASSERT(diffOutput); - ASSERT(diffOutput->diff.valid()); + ASSERT_OK(validateBSON(diffOutput->diff)); BSONObjBuilder expectedOutputBuilder; buildDeepObj(&expectedOutputBuilder, |