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:56:22 +0000 |
commit | 8ab01805980029450ae6730c24e9bdcaaeeaf402 (patch) | |
tree | b22e281491b0d99b285442115df515a24fbc59e1 | |
parent | 89306fde6167fa12ea6e30d61e05791e8e214e55 (diff) | |
download | mongo-8ab01805980029450ae6730c24e9bdcaaeeaf402.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)
-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 6b5d355c053..6270364d85b 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 @@ 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, @@ -124,7 +132,7 @@ } // 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) @@ -164,7 +172,7 @@ } // 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) @@ -203,7 +211,7 @@ // 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) @@ -244,7 +252,7 @@ } // 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) @@ -280,7 +288,7 @@ } // 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(); |