diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2018-01-30 10:10:25 -0500 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2018-01-30 10:15:57 -0500 |
commit | 7cbd64fba871bf8543ec0f9b7c6429dd30b978c9 (patch) | |
tree | 9d8d2fcc3e2b3592405b9644eb1eb839cbf9c1cc /src/mongo/db/repl/apply_ops_test.cpp | |
parent | 1a8a0e35dca5f3a2bd4fa40a5e80576f1c72e221 (diff) | |
download | mongo-7cbd64fba871bf8543ec0f9b7c6429dd30b978c9.tar.gz |
SERVER-32241 Make applyOps report failure when a nested applyOps fails.
Diffstat (limited to 'src/mongo/db/repl/apply_ops_test.cpp')
-rw-r--r-- | src/mongo/db/repl/apply_ops_test.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repl/apply_ops_test.cpp b/src/mongo/db/repl/apply_ops_test.cpp index 5a799beed44..525c23c2573 100644 --- a/src/mongo/db/repl/apply_ops_test.cpp +++ b/src/mongo/db/repl/apply_ops_test.cpp @@ -166,7 +166,7 @@ TEST_F(ApplyOpsTest, InsertInNestedApplyOpsReturnsSuccess) { auto innerCmdObj = BSON("op" << "i" << "ns" - << nss.getCommandNS().ns() + << nss.ns() << "o" << BSON("_id" << "a")); @@ -178,8 +178,9 @@ TEST_F(ApplyOpsTest, InsertInNestedApplyOpsReturnsSuccess) { << BSON("applyOps" << BSON_ARRAY(innerCmdObj))); auto cmdObj = BSON("applyOps" << BSON_ARRAY(innerApplyOpsObj)); + ASSERT_OK(_storage->createCollection(opCtx.get(), nss, CollectionOptions())); ASSERT_OK(applyOps(opCtx.get(), nss.db().toString(), cmdObj, mode, &resultBuilder)); - ASSERT_BSONOBJ_EQ({}, _opObserver->onApplyOpsCmdObj); + ASSERT_BSONOBJ_EQ(BSON("applyOps" << BSON_ARRAY(innerCmdObj)), _opObserver->onApplyOpsCmdObj); } TEST_F(ApplyOpsTest, AtomicApplyOpsWithNoOpsReturnsSuccess) { @@ -222,7 +223,7 @@ TEST_F(ApplyOpsTest, auto documentToInsert = BSON("_id" << 0); auto cmdObj = makeApplyOpsWithInsertOperation(nss, boost::none, documentToInsert); BSONObjBuilder resultBuilder; - ASSERT_EQUALS(ErrorCodes::UnknownError, + ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, applyOps(opCtx.get(), "test", cmdObj, mode, &resultBuilder)); auto result = resultBuilder.obj(); auto status = getStatusFromApplyOpsResult(result); @@ -279,7 +280,7 @@ TEST_F(ApplyOpsTest, AtomicApplyOpsInsertWithUuidIntoCollectionWithoutUuid) { auto documentToInsert = BSON("_id" << 0); auto cmdObj = makeApplyOpsWithInsertOperation(nss, uuid, documentToInsert); BSONObjBuilder resultBuilder; - ASSERT_EQUALS(ErrorCodes::UnknownError, + ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, applyOps(opCtx.get(), "test", cmdObj, mode, &resultBuilder)); auto result = resultBuilder.obj(); auto status = getStatusFromApplyOpsResult(result); |