summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/dbtests/mock/mock_remote_db_server.cpp10
-rw-r--r--src/mongo/dbtests/mock/mock_remote_db_server.h18
-rw-r--r--src/mongo/s/shard_conn_test.cpp2
3 files changed, 18 insertions, 12 deletions
diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.cpp b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
index 0887b323e7a..58ce8a07f6b 100644
--- a/src/mongo/dbtests/mock/mock_remote_db_server.cpp
+++ b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
@@ -51,9 +51,9 @@ namespace mongo {
return reply;
}
- MockRemoteDBServer::MockRemoteDBServer(const string& hostName):
+ MockRemoteDBServer::MockRemoteDBServer(const string& hostAndPort):
_isRunning(true),
- _hostName(hostName),
+ _hostAndPort(hostAndPort),
_delayMilliSec(0),
_cmdCount(0),
_queryCount(0),
@@ -191,18 +191,18 @@ namespace mongo {
}
string MockRemoteDBServer::getServerAddress() const {
- return _hostName;
+ return _hostAndPort;
}
string MockRemoteDBServer::toString() {
- return _hostName;
+ return _hostAndPort;
}
void MockRemoteDBServer::checkIfUp(InstanceID id) const {
scoped_spinlock sLock(_lock);
if (!_isRunning || id < _instanceID) {
- throw mongo::SocketException(mongo::SocketException::CLOSED, _hostName);
+ throw mongo::SocketException(mongo::SocketException::CLOSED, _hostAndPort);
}
}
}
diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.h b/src/mongo/dbtests/mock/mock_remote_db_server.h
index 0b2823ca580..8f478dc199e 100644
--- a/src/mongo/dbtests/mock/mock_remote_db_server.h
+++ b/src/mongo/dbtests/mock/mock_remote_db_server.h
@@ -41,20 +41,20 @@ namespace mongo {
* ConnectionString class by using mongo::MockConnRegistry as follows:
*
* ConnectionString::setConnectionHook(MockConnRegistry::get()->getConnStrHook());
- * MockRemoteDBServer server("$a");
+ * MockRemoteDBServer server("$a:27017");
* MockConnRegistry::get()->addServer(&server);
*
* This allows clients using the ConnectionString::connect interface to create
* connections to this server. The requirements to make this hook fully functional are:
*
- * 1. hostName of this server should start with $.
- * 2. No other instance has the same hostName as this.
+ * 1. hostAndPort of this server should start with $.
+ * 2. No other instance has the same hostAndPort as this.
*
- * @param hostName the host name for this server.
+ * @param hostAndPort the host name with port for this server.
*
* @see MockConnRegistry
*/
- MockRemoteDBServer(const std::string& hostName);
+ MockRemoteDBServer(const std::string& hostAndPort);
virtual ~MockRemoteDBServer();
//
@@ -140,6 +140,12 @@ namespace mongo {
InstanceID getInstanceID() const;
mongo::ConnectionString::ConnectionType type() const;
double getSoTimeout() const;
+
+ /**
+ * @return the exact string address passed to hostAndPort parameter of the
+ * constructor. In other words, doesn't automatically append a
+ * 'default' port if none is specified.
+ */
std::string getServerAddress() const;
std::string toString();
@@ -179,7 +185,7 @@ namespace mongo {
bool _isRunning;
- const std::string _hostName;
+ const std::string _hostAndPort;
long long _delayMilliSec;
//
diff --git a/src/mongo/s/shard_conn_test.cpp b/src/mongo/s/shard_conn_test.cpp
index 060007b3bf4..97888823c46 100644
--- a/src/mongo/s/shard_conn_test.cpp
+++ b/src/mongo/s/shard_conn_test.cpp
@@ -60,7 +60,7 @@ namespace mongo {
}
namespace mongo_test {
- const string TARGET_HOST = "$dummy";
+ const string TARGET_HOST = "$dummy:27017";
/**
* Warning: cannot run in parallel