summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2021-06-09 14:11:46 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-09 23:13:01 +0000
commitf78438d7f2ebf71491720fa1789bbf2a536a7d66 (patch)
treead9b04080eb9f8b95036839a8b011f994baef8aa /jstests
parent5476797a46b28156134fa7f13c15cd34f9e6ceb9 (diff)
downloadmongo-f78438d7f2ebf71491720fa1789bbf2a536a7d66.tar.gz
SERVER-57497 store_retryable_find_and_modify_images_in_side_collection.js should account for a later clustertime in retried findAndModify responses
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js18
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 04dcd078d42..a4860be7c03 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();