summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/indexupdatetests.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-11-29 17:54:05 -0500
committerLouis Williams <louis.williams@mongodb.com>2018-12-06 12:04:01 -0500
commit621f411f07f110992eb6a09ba44a5cc0b4af8a3e (patch)
treed35f794a7e6e9f52e4fb2444f3a73bfb7644bf67 /src/mongo/dbtests/indexupdatetests.cpp
parente64df72bb1cbc4b9296577d9a5ac6864ac41a292 (diff)
downloadmongo-621f411f07f110992eb6a09ba44a5cc0b4af8a3e.tar.gz
SERVER-38036 Turn on hybrid builds for background, unique indexes
Diffstat (limited to 'src/mongo/dbtests/indexupdatetests.cpp')
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index 9c44428ef6d..0244ff0122e 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -206,7 +206,17 @@ public:
ASSERT_OK(indexer.init(spec).getStatus());
const Status status = indexer.insertAllDocumentsInCollection();
- ASSERT_EQUALS(status.code(), ErrorCodes::DuplicateKey);
+ if (!background) {
+ ASSERT_EQUALS(status.code(), ErrorCodes::DuplicateKey);
+ return;
+ }
+
+ // Background builds do not detect duplicates until they commit.
+ ASSERT_OK(status);
+
+ WriteUnitOfWork wunit(&_opCtx);
+ ASSERT_THROWS_CODE(indexer.commit(), AssertionException, ErrorCodes::DuplicateKey);
+ wunit.commit();
}
};