summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
authorMatt Diener <matt.diener@mongodb.com>2022-07-29 12:30:03 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-29 13:04:18 +0000
commit78f116db0004bdb17bdaecaf9702af2081f165ef (patch)
tree582ca7c20f72e4c9a90540b9ba2e5b9244d26420 /src/mongo/util
parentf0818c2c2c7745c16a8c981bcbc289aac5e619f6 (diff)
downloadmongo-78f116db0004bdb17bdaecaf9702af2081f165ef.tar.gz
SERVER-67606 replace instances of ErrorCategory::Interruption in tests
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/assert_util_test.cpp13
-rw-r--r--src/mongo/util/periodic_runner_impl_test.cpp2
2 files changed, 2 insertions, 13 deletions
diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp
index 5b5816105d2..3b170a5496f 100644
--- a/src/mongo/util/assert_util_test.cpp
+++ b/src/mongo/util/assert_util_test.cpp
@@ -78,8 +78,6 @@ MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError
ExceptionFor<ErrorCodes::BadValue>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::BadValue>>());
-MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
- ExceptionFor<ErrorCodes::BadValue>>());
TEST(AssertUtils, UassertNamedCodeWithoutCategories) {
ASSERT_CATCHES(ErrorCodes::BadValue, DBException);
@@ -88,7 +86,6 @@ TEST(AssertUtils, UassertNamedCodeWithoutCategories) {
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionFor<ErrorCodes::DuplicateKey>);
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::NetworkError>);
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::NotPrimaryError>);
- ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::Interruption>);
}
// NotWritablePrimary - NotPrimaryError, RetriableError
@@ -101,8 +98,6 @@ MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError
ExceptionFor<ErrorCodes::NotWritablePrimary>>());
MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::NotWritablePrimary>>());
-MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
- ExceptionFor<ErrorCodes::NotWritablePrimary>>());
TEST(AssertUtils, UassertNamedCodeWithOneCategory) {
ASSERT_CATCHES(ErrorCodes::NotWritablePrimary, DBException);
@@ -112,11 +107,10 @@ TEST(AssertUtils, UassertNamedCodeWithOneCategory) {
ASSERT_NOT_CATCHES(ErrorCodes::NotWritablePrimary,
ExceptionForCat<ErrorCategory::NetworkError>);
ASSERT_CATCHES(ErrorCodes::NotWritablePrimary, ExceptionForCat<ErrorCategory::NotPrimaryError>);
- ASSERT_NOT_CATCHES(ErrorCodes::NotWritablePrimary,
- ExceptionForCat<ErrorCategory::Interruption>);
}
// InterruptedDueToReplStateChange - NotPrimaryError, Interruption, RetriableError
+// TODO(SERVER-56251): revise list when removing the Interruption category.
MONGO_STATIC_ASSERT(
std::is_same<error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToReplStateChange>,
error_details::CategoryList<ErrorCategory::Interruption,
@@ -128,8 +122,6 @@ MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
-MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
TEST(AssertUtils, UassertNamedCodeWithTwoCategories) {
ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, DBException);
@@ -142,8 +134,6 @@ TEST(AssertUtils, UassertNamedCodeWithTwoCategories) {
ExceptionForCat<ErrorCategory::NetworkError>);
ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
ExceptionForCat<ErrorCategory::NotPrimaryError>);
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
- ExceptionForCat<ErrorCategory::Interruption>);
}
MONGO_STATIC_ASSERT(!error_details::isNamedCode<19999>);
@@ -155,7 +145,6 @@ TEST(AssertUtils, UassertNumericCode) {
ASSERT_NOT_CATCHES(19999, ExceptionFor<ErrorCodes::DuplicateKey>);
ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::NetworkError>);
ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::NotPrimaryError>);
- ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::Interruption>);
}
TEST(AssertUtils, UassertStatusOKPreservesExtraInfo) {
diff --git a/src/mongo/util/periodic_runner_impl_test.cpp b/src/mongo/util/periodic_runner_impl_test.cpp
index 6f180269cec..9b2d3ca5e10 100644
--- a/src/mongo/util/periodic_runner_impl_test.cpp
+++ b/src/mongo/util/periodic_runner_impl_test.cpp
@@ -466,7 +466,7 @@ TEST_F(PeriodicRunnerImplTest, StopProperlyInterruptsOpCtx) {
auto opCtx = client->makeOperationContext();
stdx::unique_lock<Latch> lk(mutex);
opCtx->waitForConditionOrInterrupt(cv, lk, [] { return false; });
- } catch (const ExceptionForCat<ErrorCategory::Interruption>& e) {
+ } catch (const ExceptionForCat<ErrorCategory::CancellationError>& e) {
ASSERT_EQ(e.code(), ErrorCodes::ClientMarkedKilled);
killed.store(true);
return;