diff options
author | jinichu <jinnybyun@gmail.com> | 2018-08-02 09:55:48 -0400 |
---|---|---|
committer | jinichu <jinnybyun@gmail.com> | 2018-08-02 09:55:48 -0400 |
commit | 5e97e5813e7ad1127d79454e52fcfe49ed129096 (patch) | |
tree | ea9c9633f1fc8a2e352fbe0bbfcc23e995dad3d5 /jstests/sharding | |
parent | 4fec0d4ab8909d8811e4e7b3fb03d0bc5b3e1f80 (diff) | |
download | mongo-5e97e5813e7ad1127d79454e52fcfe49ed129096.tar.gz |
SERVER-36361 Round timeOpenMicros to have millisecond precision for assertions that use ISODate
Diffstat (limited to 'jstests/sharding')
-rw-r--r-- | jstests/sharding/aggregation_currentop.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/jstests/sharding/aggregation_currentop.js b/jstests/sharding/aggregation_currentop.js index f8e9e9f59b9..3572285ce79 100644 --- a/jstests/sharding/aggregation_currentop.js +++ b/jstests/sharding/aggregation_currentop.js @@ -771,8 +771,11 @@ TestData.skipAwaitingReplicationOnShardsBeforeCheckingUUIDs = true; assert.eq(transactionDocument.parameters.readConcern, {level: "snapshot"}); assert.gte(transactionDocument.readTimestamp, operationTime); assert.gte(ISODate(transactionDocument.startWallClockTime), timeBeforeTransactionStarts); - assert.gt(transactionDocument.timeOpenMicros, - (timeBeforeCurrentOp - timeAfterTransactionStarts) * 1000); + // We round timeOpenMicros up to the nearest multiple of 1000 to avoid occasional assertion + // failures caused by timeOpenMicros having microsecond precision while + // timeBeforeCurrentOp/timeAfterTransactionStarts only have millisecond precision. + assert.gte(Math.ceil(transactionDocument.timeOpenMicros / 1000) * 1000, + (timeBeforeCurrentOp - timeAfterTransactionStarts) * 1000); assert.gte(transactionDocument.timeActiveMicros, 0); assert.gte(transactionDocument.timeInactiveMicros, 0); assert.eq( |