summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_impl_test.cpp
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2018-10-02 18:01:59 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2018-10-02 18:03:42 -0400
commit0380ac1465fcd05e2577351d5df226eb6bbccaa5 (patch)
tree68112921bf2524cb3da13f6255577edb7917ab7b /src/mongo/db/repl/storage_interface_impl_test.cpp
parent2d379ce39872fdfc04e6775ed8adea7ccdd1d1c1 (diff)
downloadmongo-0380ac1465fcd05e2577351d5df226eb6bbccaa5.tar.gz
SERVER-37365 Don't use `ignore()` in some tests.
It shouldn't be necessary to explicitly ignore status returns in functions when testing their throw behavior - the test is sufficient to indicate that `Status` is ignored.
Diffstat (limited to 'src/mongo/db/repl/storage_interface_impl_test.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_impl_test.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl_test.cpp b/src/mongo/db/repl/storage_interface_impl_test.cpp
index c14d6a9c00b..66787596d28 100644
--- a/src/mongo/db/repl/storage_interface_impl_test.cpp
+++ b/src/mongo/db/repl/storage_interface_impl_test.cpp
@@ -525,7 +525,7 @@ TEST_F(StorageInterfaceImplTest, InsertDocumentThrowsNamespaceNotFoundIfOplogUUI
auto opCtx = getOperationContext();
StorageInterfaceImpl storage;
ASSERT_THROWS_CODE(
- storage.insertDocuments(opCtx, {"local", UUID::gen()}, transformInserts({op})).ignore(),
+ storage.insertDocuments(opCtx, {"local", UUID::gen()}, transformInserts({op})),
DBException,
ErrorCodes::NamespaceNotFound);
}
@@ -1910,10 +1910,9 @@ TEST_F(StorageInterfaceImplTest, FindByIdThrowsIfUUIDNotInCatalog) {
auto obj = BSON("_id"
<< "kyle");
StorageInterfaceImpl storage;
- ASSERT_THROWS_CODE(
- storage.findById(opCtx, {"local", UUID::gen()}, obj["_id"]).getStatus().ignore(),
- DBException,
- ErrorCodes::NamespaceNotFound);
+ ASSERT_THROWS_CODE(storage.findById(opCtx, {"local", UUID::gen()}, obj["_id"]).getStatus(),
+ DBException,
+ ErrorCodes::NamespaceNotFound);
}
TEST_F(StorageInterfaceImplTest, FindByIdReturnsNamespaceNotFoundWhenDatabaseDoesNotExist) {
@@ -2003,10 +2002,9 @@ TEST_F(StorageInterfaceImplTest, DeleteByIdThrowsIfUUIDNotInCatalog) {
auto obj = BSON("_id"
<< "kyle");
StorageInterfaceImpl storage;
- ASSERT_THROWS_CODE(
- storage.deleteById(opCtx, {"local", UUID::gen()}, obj["_id"]).getStatus().ignore(),
- DBException,
- ErrorCodes::NamespaceNotFound);
+ ASSERT_THROWS_CODE(storage.deleteById(opCtx, {"local", UUID::gen()}, obj["_id"]).getStatus(),
+ DBException,
+ ErrorCodes::NamespaceNotFound);
}
TEST_F(StorageInterfaceImplTest, DeleteByIdReturnsNamespaceNotFoundWhenDatabaseDoesNotExist) {
@@ -2078,7 +2076,7 @@ TEST_F(StorageInterfaceImplTest, UpsertByIdThrowsIfUUIDNotInCatalog) {
auto obj = BSON("_id"
<< "kyle");
StorageInterfaceImpl storage;
- ASSERT_THROWS_CODE(storage.upsertById(opCtx, {"local", UUID::gen()}, obj["_id"], obj).ignore(),
+ ASSERT_THROWS_CODE(storage.upsertById(opCtx, {"local", UUID::gen()}, obj["_id"], obj),
DBException,
ErrorCodes::NamespaceNotFound);
}
@@ -2265,17 +2263,15 @@ TEST_F(StorageInterfaceImplTest,
auto unknownUpdateOp = BSON("$unknownUpdateOp" << BSON("x" << 1000));
ASSERT_THROWS_CODE_AND_WHAT(
- storage.upsertById(opCtx, nss, BSON("" << 1).firstElement(), unknownUpdateOp).ignore(),
+ storage.upsertById(opCtx, nss, BSON("" << 1).firstElement(), unknownUpdateOp),
AssertionException,
ErrorCodes::FailedToParse,
"Unknown modifier: $unknownUpdateOp");
- ASSERT_THROWS_CODE(storage
- .upsertById(opCtx,
- {nss.db().toString(), *options.uuid},
- BSON("" << 1).firstElement(),
- unknownUpdateOp)
- .ignore(),
+ ASSERT_THROWS_CODE(storage.upsertById(opCtx,
+ {nss.db().toString(), *options.uuid},
+ BSON("" << 1).firstElement(),
+ unknownUpdateOp),
DBException,
ErrorCodes::FailedToParse);
}