-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
ALL
-
-
Programmability 2026-02-02
-
None
-
None
-
None
-
None
-
None
-
None
-
None
ASSERT_THROWS_CODE test macro erroneously report no exception was thrown even if an exception was actually thrown by the given function. This is an example of the output of the unittest when this happens:
src/mongo/db/shard_role/shard_role_test.cpp:2032: Failure
Value of: [&] \{ (void)(restoreTransactionResourcesToOperationContext( operationContext(), std::move(yieldedTransactionResources))); }
Expected: throws an exception which is a mongo::DBException which is an object whose given property is equal to ZoneNotFound
Actual: 16-byte object <80-85 8C-FF 27-10 00-00 90-A1 54-C7 FF-FF 00-00>, does not throw any exception
Stack trace:
0xac2a1e786e9c: mongo::(anonymous namespace)::ShardRoleTest::testRestoreFailsIfCollectionDroppedAndRecreated()
0xac2a1e7894a8: mongo::(anonymous namespace)::ShardRoleTest_RestoreForReadFailsIfCollectionDroppedAndRecreated_Test::TestBody()
0xac2a287c8d68: testing::internal::HandleSehExceptionsInMethodIfSupported<>()
0xac2a287b1714: testing::internal::HandleExceptionsInMethodIfSupported<>()
0xac2a287930e8: testing::Test::Run()
0xac2a28793bd0: testing::TestInfo::Run()
... Google Test internal frames ...
In the output it says the code didn't throw but it actually threw QueryPlanKilled exception.
- is related to
-
SERVER-115106 Merge spm-2926-gtest feature branch into master
-
- Closed
-
-
SERVER-111725 Implement ASSERT_THROWS(expr,ET) with exception matcher instead of typename
-
- In Progress
-