summaryrefslogtreecommitdiff
path: root/src/mongo/unittest/unittest.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2020-03-02 22:11:36 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-03 03:29:45 +0000
commit6580304d0211f406566514ec68d5865a6a9e7810 (patch)
tree22b9d1710b387e9e880f96a26b4315c6f52ed049 /src/mongo/unittest/unittest.h
parent33ba055bad586903038902825c14948038ad495e (diff)
downloadmongo-6580304d0211f406566514ec68d5865a6a9e7810.tar.gz
SERVER-46219 Unittests should log with JSON format
Diffstat (limited to 'src/mongo/unittest/unittest.h')
-rw-r--r--src/mongo/unittest/unittest.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h
index 9e2c2fd0518..aef0254c8b3 100644
--- a/src/mongo/unittest/unittest.h
+++ b/src/mongo/unittest/unittest.h
@@ -585,6 +585,7 @@ protected:
* the last call to startCapturingLogMessages() in this test.
*/
const std::vector<std::string>& getCapturedTextFormatLogMessages() const;
+ const std::vector<BSONObj> getCapturedBSONFormatLogMessages() const;
/**
* Returns the number of collected log lines containing "needle".
@@ -592,6 +593,21 @@ protected:
int64_t countTextFormatLogLinesContaining(const std::string& needle);
/**
+ * Returns the number of collected log lines where "needle" is a subset of a line.
+ *
+ * Does a Depth-First-Search of a BSON document. Validates each element in "needle" exists in
+ * "haystack". It ignores extra elements in "haystack".
+ *
+ * In example haystack: { i : 1, a : { b : 1 } },
+ * a valid needles include: { i : 1} or {a : { b : 1}}
+ * It will not find { b: 1 } since it does not search recursively for sub-tree matches.
+ *
+ * If a BSON Element is undefined, it simply checks for its existence, not its type or value.
+ * This allows callers to test for the existence of elements in variable length log lines.
+ */
+ int64_t countBSONFormatLogLinesIsSubset(const BSONObj needle);
+
+ /**
* Prints the captured log lines.
*/
void printCapturedTextFormatLogLines() const;