summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2022-07-05 20:01:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-06 13:40:26 +0000
commit5451a539fd4e469c66b35a263a169aaa485604a5 (patch)
tree17a6600842ee9915e1f668bb8d87e1dc894880d3 /src/mongo/dbtests
parent5368a88cb831e3bab64fd4fa1198adeebb190c66 (diff)
downloadmongo-5451a539fd4e469c66b35a263a169aaa485604a5.tar.gz
SERVER-65946 Have DBClient::call always throw exceptions on failure
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/mock/mock_dbclient_connection.cpp10
-rw-r--r--src/mongo/dbtests/mock/mock_dbclient_connection.h7
2 files changed, 7 insertions, 10 deletions
diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
index 957888cfa35..0e505eb479a 100644
--- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
+++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
@@ -195,10 +195,9 @@ void MockDBClientConnection::killCursor(const NamespaceString& ns, long long cur
// It is not worth the bother of killing the cursor in the mock.
}
-bool MockDBClientConnection::call(mongo::Message& toSend,
- mongo::Message& response,
- bool assertOk,
- string* actualServer) {
+void MockDBClientConnection::_call(mongo::Message& toSend,
+ mongo::Message& response,
+ string* actualServer) {
// Here we check for a getMore command, and if it is that, we respond with the next
// reply message from the previous command that returned a cursor response.
// This allows us to mock commands with implicit cursors (e.g. listCollections).
@@ -215,7 +214,7 @@ bool MockDBClientConnection::call(mongo::Message& toSend,
parsedMsg.body.firstElement().fieldName() == "getMore"_sd) {
auto reply = runCommandWithTarget(*_lastCursorMessage).first;
response = reply.releaseMessage();
- return true;
+ return;
}
}
@@ -242,7 +241,6 @@ bool MockDBClientConnection::call(mongo::Message& toSend,
const auto& swResponse = *_callIter;
_callIter++;
response = uassertStatusOK(swResponse);
- return true;
}
Status MockDBClientConnection::recv(mongo::Message& m, int lastRequestId) {
diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h
index 4b60f2bec4a..0d83e22c372 100644
--- a/src/mongo/dbtests/mock/mock_dbclient_connection.h
+++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h
@@ -141,10 +141,6 @@ public:
bool removeMany = true,
boost::optional<BSONObj> writeConcernObj = boost::none) override;
- bool call(mongo::Message& toSend,
- mongo::Message& response,
- bool assertOk,
- std::string* actualServer) override;
Status recv(mongo::Message& m, int lastRequestId) override;
void shutdown() override;
@@ -181,6 +177,9 @@ public:
std::string* actualServer = nullptr) override;
private:
+ void _call(mongo::Message& toSend,
+ mongo::Message& response,
+ std::string* actualServer) override;
void checkConnection() override;
std::unique_ptr<DBClientCursor> bsonArrayToCursor(BSONArray results,