diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2018-08-14 13:38:17 -0400 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2018-08-14 13:38:17 -0400 |
commit | 41005a73c8534953c4627b2a9d82a776e4276f1f (patch) | |
tree | a77a2466ab4d7ccc418880c44e0ba7ecca6f2ef0 /src/mongo/client/dbclient_rs_test.cpp | |
parent | 63c586c5571176a5a68d7d18e836e38e0a905211 (diff) | |
download | mongo-41005a73c8534953c4627b2a9d82a776e4276f1f.tar.gz |
SERVER-36094 Make DBClientBase::query() take an NamespaceStringOrUUID
Diffstat (limited to 'src/mongo/client/dbclient_rs_test.cpp')
-rw-r--r-- | src/mongo/client/dbclient_rs_test.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index d0fec97f3d2..799713d98c1 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -128,7 +128,7 @@ TEST_F(BasicRS, QueryPrimary) { query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -145,7 +145,7 @@ TEST_F(BasicRS, QuerySecondaryOnly) { query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -166,7 +166,7 @@ TEST_F(BasicRS, QueryPrimaryPreferred) { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -186,7 +186,7 @@ TEST_F(BasicRS, QuerySecondaryPreferred) { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -245,7 +245,7 @@ TEST_F(AllNodesDown, QueryPrimary) { Query query; query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(AllNodesDown, CommandPrimary) { @@ -258,7 +258,7 @@ TEST_F(AllNodesDown, QuerySecondaryOnly) { Query query; query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(AllNodesDown, CommandSecondaryOnly) { @@ -271,7 +271,7 @@ TEST_F(AllNodesDown, QueryPrimaryPreferred) { Query query; query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(AllNodesDown, CommandPrimaryPreferred) { @@ -284,7 +284,7 @@ TEST_F(AllNodesDown, QuerySecondaryPreferred) { Query query; query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(AllNodesDown, CommandSecondaryPreferred) { @@ -297,7 +297,7 @@ TEST_F(AllNodesDown, QueryNearest) { Query query; query.readPref(mongo::ReadPreference::Nearest, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(AllNodesDown, CommandNearest) { @@ -338,7 +338,7 @@ TEST_F(PrimaryDown, QueryPrimary) { Query query; query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(PrimaryDown, CommandPrimary) { @@ -353,7 +353,7 @@ TEST_F(PrimaryDown, QuerySecondaryOnly) { query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -371,7 +371,7 @@ TEST_F(PrimaryDown, QueryPrimaryPreferred) { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -389,7 +389,7 @@ TEST_F(PrimaryDown, QuerySecondaryPreferred) { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -405,7 +405,7 @@ TEST_F(PrimaryDown, Nearest) { Query query; query.readPref(mongo::ReadPreference::Nearest, BSONArray()); - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -447,7 +447,7 @@ TEST_F(SecondaryDown, QueryPrimary) { query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -462,7 +462,7 @@ TEST_F(SecondaryDown, QuerySecondaryOnly) { Query query; query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); - ASSERT_THROWS(replConn.query(IdentityNS, query), AssertionException); + ASSERT_THROWS(replConn.query(NamespaceString(IdentityNS), query), AssertionException); } TEST_F(SecondaryDown, CommandSecondaryOnly) { @@ -477,7 +477,7 @@ TEST_F(SecondaryDown, QueryPrimaryPreferred) { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -494,7 +494,7 @@ TEST_F(SecondaryDown, QuerySecondaryPreferred) { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -511,7 +511,7 @@ TEST_F(SecondaryDown, QueryNearest) { query.readPref(mongo::ReadPreference::Nearest, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -657,7 +657,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldPinIfSameSettings) { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); } @@ -665,7 +665,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldPinIfSameSettings) { { Query query; query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_EQUALS(dest, newDest); @@ -685,7 +685,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfHostMarkedAsFailed) { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); } @@ -699,7 +699,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfHostMarkedAsFailed) { { Query query; query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -722,7 +722,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfDiffMode) { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); @@ -731,7 +731,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfDiffMode) { { Query query; query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -756,7 +756,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfDiffTag) { << "sf"))); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); @@ -766,7 +766,7 @@ TEST_F(TaggedFiveMemberRS, ConnShouldNotPinIfDiffTag) { Query query; vector<pair<string, string>> tagSet; query.readPref(mongo::ReadPreference::SecondaryPreferred, BSON_ARRAY(BSON("group" << 1))); - unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(NamespaceString(IdentityNS), query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -789,7 +789,7 @@ TEST_F(TaggedFiveMemberRS, SlaveConnReturnsSecConn) { mongo::DBClientConnection& secConn = replConn.slaveConn(); // Note: IdentityNS contains the name of the server. - unique_ptr<DBClientCursor> cursor = secConn.query(IdentityNS, Query()); + unique_ptr<DBClientCursor> cursor = secConn.query(NamespaceString(IdentityNS), Query()); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); |