diff options
author | Jason Chan <jason.chan@mongodb.com> | 2021-06-09 14:11:46 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-10 17:43:26 +0000 |
commit | 43050f26a0f72ba67bd7c1d515cfe3d4dda4d008 (patch) | |
tree | 9d309a4cfafa845ba876ac839a2f96b146a7fc92 /jstests | |
parent | 7422c4b98cca31f390b7e09e23a94a66cb1fa26f (diff) | |
download | mongo-43050f26a0f72ba67bd7c1d515cfe3d4dda4d008.tar.gz |
SERVER-57497 store_retryable_find_and_modify_images_in_side_collection.js should account for a later clustertime in retried findAndModify responses
(cherry picked from commit f78438d7f2ebf71491720fa1789bbf2a536a7d66)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js b/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js index df13eddb033..e07cc0deb65 100644 --- a/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js +++ b/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js @@ -54,6 +54,14 @@ function checkImageCollection(conn, sessionInfo, expectedTs, expectedImage, expe assert.eq(expectedTs.getTime(), imageDoc.ts.getTime(), imageDoc); } +function assertRetryCommand(cmdResponse, retryResponse) { + // The retry response can contain a different 'clusterTime' from the initial response. + delete cmdResponse.$clusterTime; + delete retryResponse.$clusterTime; + + assert.eq(cmdResponse, retryResponse); +} + function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollection, docId) { const setParam = { setParameter: 1, @@ -123,7 +131,7 @@ function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollectio } // Assert that retrying the command will produce the same response. let retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd)); - assert.eq(res, retryRes); + assertRetryCommand(res, retryRes); //////////////////////////////////////////////////////////////////////// // Test findAndModify command (in-place update, return post-image) @@ -162,7 +170,7 @@ function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollectio } // Assert that retrying the command will produce the same response. retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd)); - assert.eq(res, retryRes); + assertRetryCommand(res, retryRes); //////////////////////////////////////////////////////////////////////// // Test findAndModify command (replacement update, return pre-image) @@ -200,7 +208,7 @@ function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollectio // Assert that retrying the command will produce the same response. retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd)); - assert.eq(res, retryRes); + assertRetryCommand(res, retryRes); //////////////////////////////////////////////////////////////////////// // Test findAndModify command (replacement update, return post-image) @@ -240,7 +248,7 @@ function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollectio } // Assert that retrying the command will produce the same response. retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd)); - assert.eq(res, retryRes); + assertRetryCommand(res, retryRes); //////////////////////////////////////////////////////////////////////// // Test findAndModify command (remove, return pre-image) @@ -275,7 +283,7 @@ function runTests(lsid, mainConn, primary, secondary, storeImagesInSideCollectio } // Assert that retrying the command will produce the same response. retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd)); - assert.eq(res, retryRes); + assertRetryCommand(res, retryRes); } const lsid = UUID(); |