summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorRichard Hausman <richard.hausman@mongodb.com>2022-08-19 17:55:53 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-19 19:31:00 +0000
commitd3ea0605477301d4055034dde5153267a61eb5ab (patch)
treebc1fcfa4b804ce2b713ed69f3bbc13eab897a515 /src/mongo/client
parent9a07ecfd7e91d330fc4cf8ea8b08e2f2e75ec04e (diff)
downloadmongo-d3ea0605477301d4055034dde5153267a61eb5ab.tar.gz
SERVER-67880 : Check BSON column is decompressible in the validate command.
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/SConscript1
-rw-r--r--src/mongo/client/mongo_uri_test.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/client/SConscript b/src/mongo/client/SConscript
index 25df63559cc..cd21400ca2b 100644
--- a/src/mongo/client/SConscript
+++ b/src/mongo/client/SConscript
@@ -71,6 +71,7 @@ if get_option('ssl') == 'on':
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/bson/bson_validate',
'$BUILD_DIR/mongo/db/server_options_core', # For object_check.h
'$BUILD_DIR/mongo/idl/idl_parser',
'$BUILD_DIR/third_party/shim_kms_message',
diff --git a/src/mongo/client/mongo_uri_test.cpp b/src/mongo/client/mongo_uri_test.cpp
index f0cb567b75d..2555121ae0f 100644
--- a/src/mongo/client/mongo_uri_test.cpp
+++ b/src/mongo/client/mongo_uri_test.cpp
@@ -33,6 +33,7 @@
#include <fstream>
#include "mongo/base/string_data.h"
+#include "mongo/bson/bson_validate.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsontypes.h"
#include "mongo/bson/json.h"
@@ -583,7 +584,7 @@ BSONObj getBsonFromJsonFile(std::string fileName) {
std::ifstream infile(filename.c_str());
std::string data((std::istreambuf_iterator<char>(infile)), std::istreambuf_iterator<char>());
BSONObj obj = fromjson(data);
- ASSERT_TRUE(obj.valid());
+ ASSERT_TRUE(validateBSON(obj).isOK());
ASSERT_TRUE(obj.hasField("tests"));
BSONObj arr = obj.getField("tests").embeddedObject().getOwned();
ASSERT_TRUE(arr.couldBeArray());