diff options
author | Mathias Stearn <mathias@10gen.com> | 2018-04-24 16:58:23 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2018-05-08 14:57:37 -0400 |
commit | 589af3820b00ed0b7ac26a84cfeed6554ab191f3 (patch) | |
tree | bb393adad8b1ca4f6f0e23c035141e829e3eeee6 /src/mongo/db/commands_test.cpp | |
parent | 98f28d452b9b330d6c1696d6d8207b582a5870fc (diff) | |
download | mongo-589af3820b00ed0b7ac26a84cfeed6554ab191f3.tar.gz |
SERVER-34628 Prep for removing appendCommandStatus
* Added appendCommandStatusNoThrow matching the current aCS behavior
* Make appendCommandStatus call uassertStatusOK then aCS on success
* Make the few places that need to not throw call aCSNT
A following commit will completely remove appendCommandStatus. It is split out
because that commit is fairly huge.
Diffstat (limited to 'src/mongo/db/commands_test.cpp')
-rw-r--r-- | src/mongo/db/commands_test.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/commands_test.cpp b/src/mongo/db/commands_test.cpp index 0dbee80db37..b2e9752e3fa 100644 --- a/src/mongo/db/commands_test.cpp +++ b/src/mongo/db/commands_test.cpp @@ -40,7 +40,7 @@ namespace { TEST(Commands, appendCommandStatusOK) { BSONObjBuilder actualResult; - CommandHelpers::appendCommandStatus(actualResult, Status::OK()); + CommandHelpers::appendCommandStatusNoThrow(actualResult, Status::OK()); BSONObjBuilder expectedResult; expectedResult.append("ok", 1.0); @@ -51,7 +51,7 @@ TEST(Commands, appendCommandStatusOK) { TEST(Commands, appendCommandStatusError) { BSONObjBuilder actualResult; const Status status(ErrorCodes::InvalidLength, "Response payload too long"); - CommandHelpers::appendCommandStatus(actualResult, status); + CommandHelpers::appendCommandStatusNoThrow(actualResult, status); BSONObjBuilder expectedResult; expectedResult.append("ok", 0.0); @@ -68,7 +68,7 @@ TEST(Commands, appendCommandStatusNoOverwrite) { actualResult.append("c", "d"); actualResult.append("ok", "not ok"); const Status status(ErrorCodes::InvalidLength, "Response payload too long"); - CommandHelpers::appendCommandStatus(actualResult, status); + CommandHelpers::appendCommandStatusNoThrow(actualResult, status); BSONObjBuilder expectedResult; expectedResult.append("a", "b"); @@ -84,7 +84,7 @@ TEST(Commands, appendCommandStatusNoOverwrite) { TEST(Commands, appendCommandStatusErrorExtraInfo) { BSONObjBuilder actualResult; const Status status(ErrorExtraInfoExample(123), "not again!"); - CommandHelpers::appendCommandStatus(actualResult, status); + CommandHelpers::appendCommandStatusNoThrow(actualResult, status); BSONObjBuilder expectedResult; expectedResult.append("ok", 0.0); @@ -362,7 +362,7 @@ struct IncrementTestCommon { CommandHelpers::extractOrAppendOk(bob); } catch (const DBException& e) { auto bob = crb.getBodyBuilder(); - CommandHelpers::appendCommandStatus(bob, e.toStatus()); + CommandHelpers::appendCommandStatusNoThrow(bob, e.toStatus()); } return BSONObj(bb.release()); }(); |