summaryrefslogtreecommitdiff
path: root/src/mongo/client/replica_set_monitor_test.cpp
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-11-29 20:01:18 -0500
committerJonathan Reams <jbreams@mongodb.com>2016-12-08 10:44:05 -0500
commitd55eb9d186f3039695a4d710116e79ad04536409 (patch)
treed7eeb820a9365d9266f926969177c05a9413e300 /src/mongo/client/replica_set_monitor_test.cpp
parente91795212e7f274db6eb66efd5bbad8f144cdf32 (diff)
downloadmongo-d55eb9d186f3039695a4d710116e79ad04536409.tar.gz
SERVER-27210 Allow shell to connect to replicasets with ssl=true in URI
Diffstat (limited to 'src/mongo/client/replica_set_monitor_test.cpp')
-rw-r--r--src/mongo/client/replica_set_monitor_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/client/replica_set_monitor_test.cpp b/src/mongo/client/replica_set_monitor_test.cpp
index 8720176b183..403e03a985a 100644
--- a/src/mongo/client/replica_set_monitor_test.cpp
+++ b/src/mongo/client/replica_set_monitor_test.cpp
@@ -77,6 +77,24 @@ TEST(ReplicaSetMonitor, InitialState) {
}
}
+TEST(ReplicaSetMonitor, InitialStateMongoURI) {
+ auto uri = MongoURI::parse("mongodb://a,b,c/?replicaSet=name");
+ ASSERT_OK(uri.getStatus());
+ SetStatePtr state = std::make_shared<SetState>(uri.getValue());
+ ASSERT_EQUALS(state->name, "name");
+ ASSERT(state->seedNodes == basicSeedsSet);
+ ASSERT(state->lastSeenMaster.empty());
+ ASSERT_EQUALS(state->nodes.size(), basicSeeds.size());
+ for (size_t i = 0; i < basicSeeds.size(); i++) {
+ Node* node = state->findNode(basicSeeds[i]);
+ ASSERT(node);
+ ASSERT_EQUALS(node->host.toString(), basicSeeds[i].toString());
+ ASSERT(!node->isUp);
+ ASSERT(!node->isMaster);
+ ASSERT(node->tags.isEmpty());
+ }
+}
+
TEST(ReplicaSetMonitor, IsMasterBadParse) {
BSONObj ismaster = BSON("hosts" << BSON_ARRAY("mongo.example:badport"));
IsMasterReply imr(HostAndPort("mongo.example:27017"), -1, ismaster);