summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-11-12 12:53:59 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-12 18:33:49 +0000
commit5a1ed37c4f76d664237f302f329fb5a540d422a2 (patch)
tree9d02e0fafc7f00a26f2aa71ed24b5ef88af86c6d /jstests
parent7c196029e8529d8d217a4c9314d8a4e6069a91d2 (diff)
downloadmongo-5a1ed37c4f76d664237f302f329fb5a540d422a2.tar.gz
SERVER-52522 add test assertions on view pipeline results
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/time_series/time_series_simple.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/jstests/core/time_series/time_series_simple.js b/jstests/core/time_series/time_series_simple.js
index 10fc290fc64..51cd17e0705 100644
--- a/jstests/core/time_series/time_series_simple.js
+++ b/jstests/core/time_series/time_series_simple.js
@@ -124,6 +124,12 @@ for (let i = 0; i < numDocs; i++) {
});
jsTestLog('Insertion took ' + ((new Date()).getTime() - start.getTime()) +
' ms. Retrieving doc from view: ' + i);
+ start = new Date();
+ const docFromView = coll.findOne({_id: doc._id});
+ assert(docFromView, 'inserted doc missing from time-series view: ' + i + ': ' + tojson(doc));
+ jsTestLog('Doc retrieval took ' + ((new Date()).getTime() - start.getTime()) +
+ ' ms. Doc fetched from view: ' + i + ': ' + tojson(docFromView));
+ assert.docEq(doc, docFromView, 'Invalid document retrieved from view: ' + i);
// Update expected control min/max and data in bucket.
Object.keys(doc).forEach((key) => {
@@ -137,6 +143,10 @@ for (let i = 0; i < numDocs; i++) {
});
}
+// Check view.
+const viewDocs = coll.find().toArray();
+assert.eq(numDocs, viewDocs.length, viewDocs);
+
// Check bucket collection.
const bucketDocs = bucketsColl.find().toArray();
assert.eq(1, bucketDocs.length, bucketDocs);