diff options
author | Benety Goh <benety@mongodb.com> | 2020-11-18 12:20:38 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-18 20:04:53 +0000 |
commit | 99479e69966cd1cdba2a104ea850d353f3c1e1e7 (patch) | |
tree | 53ed412e216ea0b296d6e9a6084663c8c860da8a /jstests | |
parent | 1983f34ee27edb027954292cb140347b0f646f0a (diff) | |
download | mongo-99479e69966cd1cdba2a104ea850d353f3c1e1e7.tar.gz |
SERVER-52526 limit size of measurements in each bucket in a time-series collection
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/time_series/time_series_bucket_limit_size.js | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/jstests/core/time_series/time_series_bucket_limit_size.js b/jstests/core/time_series/time_series_bucket_limit_size.js index 317328d8c67..86cde463db2 100644 --- a/jstests/core/time_series/time_series_bucket_limit_size.js +++ b/jstests/core/time_series/time_series_bucket_limit_size.js @@ -57,24 +57,39 @@ for (let i = 0; i < numDocs; i++) { // Check bucket collection. const bucketDocs = bucketsColl.find().sort({_id: 1}).toArray(); -assert.eq(1, bucketDocs.length, bucketDocs); +assert.eq(2, bucketDocs.length, bucketDocs); // Check both buckets. // First bucket should be full with one document since we spill the second document over into the // second bucket due to size constraints on 'data'. -assert.eq(numDocs, - bucketDocs[0].control.count, - 'invalid count in first bucket: ' + tojson(bucketDocs[0])); +assert.eq( + 1, bucketDocs[0].control.count, 'invalid count in first bucket: ' + tojson(bucketDocs[0])); assert.eq(0, bucketDocs[0].control.min._id, 'invalid control.min for _id in first bucket: ' + tojson(bucketDocs[0].control)); assert.eq(largeValue, bucketDocs[0].control.min.x, 'invalid control.min for x in first bucket: ' + tojson(bucketDocs[0].control)); -assert.eq(numDocs - 1, +assert.eq(0, bucketDocs[0].control.max._id, 'invalid control.max for _id in first bucket: ' + tojson(bucketDocs[0].control)); assert.eq(largeValue, bucketDocs[0].control.max.x, 'invalid control.max for x in first bucket: ' + tojson(bucketDocs[0].control)); + +// Second bucket should contain the remaining document. +assert.eq( + 1, bucketDocs[1].control.count, 'invalid count in second bucket: ' + tojson(bucketDocs[1])); +assert.eq(numDocs - 1, + bucketDocs[1].control.min._id, + 'invalid control.min for _id in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(largeValue, + bucketDocs[1].control.min.x, + 'invalid control.min for x in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(numDocs - 1, + bucketDocs[1].control.max._id, + 'invalid control.max for _id in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(largeValue, + bucketDocs[1].control.max.x, + 'invalid control.max for x in second bucket: ' + tojson(bucketDocs[1].control)); })(); |