summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2020-07-03 09:12:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-03 09:25:59 +0000
commitc49e2d8c48abbd734fc99b906547b3a78b53e806 (patch)
treee9aaaf2e4d9cd2df7676d9e0cf8b23321589ff1a /src/mongo/db
parente433dda6115621d018291503e4485a764cbdc139 (diff)
downloadmongo-c49e2d8c48abbd734fc99b906547b3a78b53e806.tar.gz
SERVER-49295 Add upsert parameter to PersistentTaskStore update
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/persistent_task_store_test.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/s/persistent_task_store_test.cpp b/src/mongo/db/s/persistent_task_store_test.cpp
index 4f251703edc..21cee5dc4dd 100644
--- a/src/mongo/db/s/persistent_task_store_test.cpp
+++ b/src/mongo/db/s/persistent_task_store_test.cpp
@@ -247,19 +247,28 @@ TEST_F(PersistentTaskStoreTest, TestUpdateWithUpsert) {
ASSERT_EQ(store.count(opCtx, query), 1);
// Verify that the task document is actually correct
- store.forEach(opCtx, query, [&](const TestTask& t) { ASSERT_EQ(t.toBSON(), task.toBSON()); });
+ store.forEach(opCtx, query, [&](const TestTask& t) {
+ ASSERT_EQ(t.toBSON().toString(), task.toBSON().toString());
+ return true;
+ });
// Verify that updates happen as normal with upsert == true and upsert == false
store.update(
opCtx, query, BSON("$inc" << BSON("min" << 1)), WriteConcerns::kMajorityWriteConcern, true);
- store.forEach(opCtx, query, [&](const TestTask& t) { ASSERT_EQ(t.min, 1); });
+ store.forEach(opCtx, query, [&](const TestTask& t) {
+ ASSERT_EQ(t.min, 1);
+ return true;
+ });
store.update(opCtx,
query,
BSON("$inc" << BSON("min" << 1)),
WriteConcerns::kMajorityWriteConcern,
false);
- store.forEach(opCtx, query, [&](const TestTask& t) { ASSERT_EQ(t.min, 2); });
+ store.forEach(opCtx, query, [&](const TestTask& t) {
+ ASSERT_EQ(t.min, 2);
+ return true;
+ });
}
TEST_F(PersistentTaskStoreTest, TestWritesPersistAcrossInstances) {