summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/basictests.cpp2
-rw-r--r--src/mongo/dbtests/chunktests.cpp5
-rw-r--r--src/mongo/dbtests/commandtests.cpp7
-rw-r--r--src/mongo/dbtests/dbtests.cpp6
-rw-r--r--src/mongo/dbtests/directclienttests.cpp5
-rw-r--r--src/mongo/dbtests/framework.cpp2
-rw-r--r--src/mongo/dbtests/framework_options.cpp28
-rw-r--r--src/mongo/dbtests/framework_options_init.cpp2
-rw-r--r--src/mongo/dbtests/index_access_method_test.cpp4
-rw-r--r--src/mongo/dbtests/indexcatalogtests.cpp3
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp138
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp326
-rw-r--r--src/mongo/dbtests/jsontests.cpp12
-rw-r--r--src/mongo/dbtests/jstests.cpp3
-rw-r--r--src/mongo/dbtests/mock/mock_remote_db_server.cpp2
-rw-r--r--src/mongo/dbtests/mock/mock_replica_set.h4
-rw-r--r--src/mongo/dbtests/mock_dbclient_conn_test.cpp12
-rw-r--r--src/mongo/dbtests/multikey_paths_test.cpp40
-rw-r--r--src/mongo/dbtests/namespacetests.cpp4
-rw-r--r--src/mongo/dbtests/oplogstarttests.cpp6
-rw-r--r--src/mongo/dbtests/plan_ranking.cpp28
-rw-r--r--src/mongo/dbtests/query_stage_count.cpp11
-rw-r--r--src/mongo/dbtests/query_stage_ensure_sorted.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_subplan.cpp3
-rw-r--r--src/mongo/dbtests/querytests.cpp57
-rw-r--r--src/mongo/dbtests/replica_set_monitor_test.cpp2
-rw-r--r--src/mongo/dbtests/repltests.cpp21
-rw-r--r--src/mongo/dbtests/sort_key_generator_test.cpp2
-rw-r--r--src/mongo/dbtests/threadedtests.cpp2
-rw-r--r--src/mongo/dbtests/updatetests.cpp59
-rw-r--r--src/mongo/dbtests/validate_tests.cpp110
31 files changed, 578 insertions, 330 deletions
diff --git a/src/mongo/dbtests/basictests.cpp b/src/mongo/dbtests/basictests.cpp
index a0b915027fa..9734c1d8aab 100644
--- a/src/mongo/dbtests/basictests.cpp
+++ b/src/mongo/dbtests/basictests.cpp
@@ -34,8 +34,8 @@
#include <iostream>
#include "mongo/db/client.h"
-#include "mongo/db/storage/paths.h"
#include "mongo/db/storage/mmap_v1/compress.h"
+#include "mongo/db/storage/paths.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/util/base64.h"
#include "mongo/util/queue.h"
diff --git a/src/mongo/dbtests/chunktests.cpp b/src/mongo/dbtests/chunktests.cpp
index 36de5ad9498..fbc7b94987a 100644
--- a/src/mongo/dbtests/chunktests.cpp
+++ b/src/mongo/dbtests/chunktests.cpp
@@ -127,8 +127,9 @@ class MultiShardBase : public Base {
return BSON_ARRAY(BSON("a"
<< "x")
<< BSON("a"
- << "y") << BSON("a"
- << "z"));
+ << "y")
+ << BSON("a"
+ << "z"));
}
};
diff --git a/src/mongo/dbtests/commandtests.cpp b/src/mongo/dbtests/commandtests.cpp
index bfe87176273..db5d6227452 100644
--- a/src/mongo/dbtests/commandtests.cpp
+++ b/src/mongo/dbtests/commandtests.cpp
@@ -258,9 +258,12 @@ public:
cmd.append("indexes",
BSON_ARRAY(BSON("key" << BSON("loc"
<< "geoHaystack"
- << "z" << 1.0) << "name"
+ << "z"
+ << 1.0)
+ << "name"
<< "loc_geoHaystack_z_1"
- << "bucketSize" << static_cast<double>(0.7))));
+ << "bucketSize"
+ << static_cast<double>(0.7))));
BSONObj result;
ASSERT(db.runCommand(nsDb(), cmd.obj(), result));
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 4a742f78e3f..b0590061e91 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -39,11 +39,11 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/service_context_d.h"
-#include "mongo/db/service_context.h"
-#include "mongo/db/wire_version.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/wire_version.h"
#include "mongo/dbtests/framework.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/quick_exit.h"
diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp
index e420ac1f0ab..8e7c4a0a1e8 100644
--- a/src/mongo/dbtests/directclienttests.cpp
+++ b/src/mongo/dbtests/directclienttests.cpp
@@ -74,7 +74,10 @@ public:
BSONObj info;
BSONObj cmd = BSON("captrunc"
<< "b"
- << "n" << 1 << "inc" << true);
+ << "n"
+ << 1
+ << "inc"
+ << true);
// cout << cmd.toString() << endl;
bool ok = client.runCommand("a", cmd, info);
// cout << info.toString() << endl;
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index a201ddfe79a..b6022383f6b 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -38,9 +38,9 @@
#include "mongo/base/status.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/s/sharding_state.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_context_d.h"
-#include "mongo/db/s/sharding_state.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/dbtests/framework_options.h"
#include "mongo/s/catalog/catalog_manager.h"
diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp
index c51bc34e00f..0d2a4768213 100644
--- a/src/mongo/dbtests/framework_options.cpp
+++ b/src/mongo/dbtests/framework_options.cpp
@@ -66,12 +66,14 @@ FrameworkGlobalParams frameworkGlobalParams;
Status addTestFrameworkOptions(moe::OptionSection* options) {
options->addOptionChaining("help", "help,h", moe::Switch, "show this usage information");
- options->addOptionChaining(
- "dbpath",
- "dbpath",
- moe::String,
- "db data path for this test run. NOTE: the contents of this directory will "
- "be overwritten if it already exists").setDefault(moe::Value(default_test_dbpath));
+ options
+ ->addOptionChaining(
+ "dbpath",
+ "dbpath",
+ moe::String,
+ "db data path for this test run. NOTE: the contents of this directory will "
+ "be overwritten if it already exists")
+ .setDefault(moe::Value(default_test_dbpath));
options->addOptionChaining("debug", "debug", moe::Switch, "run tests with verbose output");
@@ -99,16 +101,18 @@ Status addTestFrameworkOptions(moe::OptionSection* options) {
options->addOptionChaining(
"perfHist", "perfHist", moe::Unsigned, "number of back runs of perf stats to display");
- options->addOptionChaining(
- "storage.engine", "storageEngine", moe::String, "what storage engine to use")
+ options
+ ->addOptionChaining(
+ "storage.engine", "storageEngine", moe::String, "what storage engine to use")
.setDefault(moe::Value(std::string("wiredTiger")));
options->addOptionChaining("suites", "suites", moe::StringVector, "test suites to run")
.hidden()
.positional(1, -1);
- options->addOptionChaining(
- "nopreallocj", "nopreallocj", moe::Switch, "disable journal prealloc").hidden();
+ options
+ ->addOptionChaining("nopreallocj", "nopreallocj", moe::Switch, "disable journal prealloc")
+ .hidden();
return Status::OK();
@@ -116,8 +120,8 @@ Status addTestFrameworkOptions(moe::OptionSection* options) {
std::string getTestFrameworkHelp(StringData name, const moe::OptionSection& options) {
StringBuilder sb;
- sb << "usage: " << name << " [options] [suite]...\n" << options.helpString()
- << "suite: run the specified test suite(s) only\n";
+ sb << "usage: " << name << " [options] [suite]...\n"
+ << options.helpString() << "suite: run the specified test suite(s) only\n";
return sb.str();
}
diff --git a/src/mongo/dbtests/framework_options_init.cpp b/src/mongo/dbtests/framework_options_init.cpp
index 7e3689ae5e9..1100b188362 100644
--- a/src/mongo/dbtests/framework_options_init.cpp
+++ b/src/mongo/dbtests/framework_options_init.cpp
@@ -31,9 +31,9 @@
#include <iostream>
#include "mongo/dbtests/framework_options.h"
+#include "mongo/util/exit_code.h"
#include "mongo/util/options_parser/startup_option_init.h"
#include "mongo/util/options_parser/startup_options.h"
-#include "mongo/util/exit_code.h"
#include "mongo/util/quick_exit.h"
namespace mongo {
diff --git a/src/mongo/dbtests/index_access_method_test.cpp b/src/mongo/dbtests/index_access_method_test.cpp
index 35e6cd020f9..f81a3039704 100644
--- a/src/mongo/dbtests/index_access_method_test.cpp
+++ b/src/mongo/dbtests/index_access_method_test.cpp
@@ -28,10 +28,10 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/index/index_access_method.h"
-#include "mongo/unittest/unittest.h"
#include "mongo/bson/bsonobj.h"
+#include "mongo/db/index/index_access_method.h"
#include "mongo/db/json.h"
+#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/dbtests/indexcatalogtests.cpp b/src/mongo/dbtests/indexcatalogtests.cpp
index 23d6e6f092a..ef2f1effb81 100644
--- a/src/mongo/dbtests/indexcatalogtests.cpp
+++ b/src/mongo/dbtests/indexcatalogtests.cpp
@@ -138,7 +138,8 @@ public:
ASSERT_OK(dbtests::createIndexFromSpec(&txn,
_ns,
BSON("name" << indexName << "ns" << _ns << "key"
- << BSON("x" << 1) << "expireAfterSeconds"
+ << BSON("x" << 1)
+ << "expireAfterSeconds"
<< 5)));
const IndexDescriptor* desc = _catalog->findIndexByName(&txn, indexName);
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index 3b3c3531ec9..99f254cb60d 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -372,8 +372,14 @@ public:
const BSONObj spec = BSON("name"
<< "a"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "unique"
- << true << "background" << background);
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "unique"
+ << true
+ << "background"
+ << background);
ASSERT_OK(indexer.init(spec));
ASSERT_OK(indexer.insertAllDocumentsInCollection());
@@ -418,8 +424,14 @@ public:
const BSONObj spec = BSON("name"
<< "a"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "unique"
- << true << "background" << background);
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "unique"
+ << true
+ << "background"
+ << background);
ASSERT_OK(indexer.init(spec));
const Status status = indexer.insertAllDocumentsInCollection();
@@ -463,8 +475,14 @@ public:
const BSONObj spec = BSON("name"
<< "a"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "unique"
- << true << "background" << background);
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "unique"
+ << true
+ << "background"
+ << background);
ASSERT_OK(indexer.init(spec));
@@ -729,7 +747,10 @@ public:
ASSERT_OK(createIndex("unittest",
BSON("name"
<< "x"
- << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1))));
+ << "ns"
+ << _ns
+ << "key"
+ << BSON("x" << 1 << "y" << 1))));
}
};
@@ -741,7 +762,11 @@ public:
createIndex("unittest",
BSON("name"
<< "x"
- << "ns" << _ns << "unique" << true << "key"
+ << "ns"
+ << _ns
+ << "unique"
+ << true
+ << "key"
<< BSON("x" << 1 << "y" << 1))));
}
};
@@ -752,7 +777,10 @@ public:
ASSERT_OK(createIndex("unittest",
BSON("name"
<< "x"
- << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1))));
+ << "ns"
+ << _ns
+ << "key"
+ << BSON("x" << 1 << "y" << 1))));
}
};
@@ -764,7 +792,10 @@ public:
createIndex("unittest",
BSON("name"
<< "x"
- << "ns" << _ns << "key" << BSON("y" << 1 << "x" << 1))));
+ << "ns"
+ << _ns
+ << "key"
+ << BSON("y" << 1 << "x" << 1))));
}
};
@@ -777,9 +808,17 @@ public:
ASSERT_OK(createIndex("unittests",
BSON("name"
<< "super"
- << "ns" << _ns << "unique" << 1 << "sparse" << true
- << "expireAfterSeconds" << 3600 << "key" << BSON("superIdx"
- << "2d"))));
+ << "ns"
+ << _ns
+ << "unique"
+ << 1
+ << "sparse"
+ << true
+ << "expireAfterSeconds"
+ << 3600
+ << "key"
+ << BSON("superIdx"
+ << "2d"))));
}
};
@@ -791,9 +830,17 @@ public:
ASSERT_OK(createIndex("unittests",
BSON("name"
<< "super2"
- << "ns" << _ns << "expireAfterSeconds" << 3600 << "sparse"
- << true << "unique" << 1 << "key" << BSON("superIdx"
- << "2d"))));
+ << "ns"
+ << _ns
+ << "expireAfterSeconds"
+ << 3600
+ << "sparse"
+ << true
+ << "unique"
+ << 1
+ << "key"
+ << BSON("superIdx"
+ << "2d"))));
}
};
@@ -807,23 +854,40 @@ public:
createIndex("unittest",
BSON("name"
<< "super2"
- << "ns" << _ns << "unique" << false << "sparse" << true
- << "expireAfterSeconds" << 3600 << "key" << BSON("superIdx"
- << "2d"))));
+ << "ns"
+ << _ns
+ << "unique"
+ << false
+ << "sparse"
+ << true
+ << "expireAfterSeconds"
+ << 3600
+ << "key"
+ << BSON("superIdx"
+ << "2d"))));
}
};
class SameSpecDifferentSparse : public ComplexIndex {
public:
void run() {
- ASSERT_EQUALS(
- ErrorCodes::IndexOptionsConflict,
- createIndex("unittest",
- BSON("name"
- << "super2"
- << "ns" << _ns << "unique" << 1 << "sparse" << false << "background"
- << true << "expireAfterSeconds" << 3600 << "key" << BSON("superIdx"
- << "2d"))));
+ ASSERT_EQUALS(ErrorCodes::IndexOptionsConflict,
+ createIndex("unittest",
+ BSON("name"
+ << "super2"
+ << "ns"
+ << _ns
+ << "unique"
+ << 1
+ << "sparse"
+ << false
+ << "background"
+ << true
+ << "expireAfterSeconds"
+ << 3600
+ << "key"
+ << BSON("superIdx"
+ << "2d"))));
}
};
@@ -834,9 +898,17 @@ public:
createIndex("unittest",
BSON("name"
<< "super2"
- << "ns" << _ns << "unique" << 1 << "sparse" << true
- << "expireAfterSeconds" << 2400 << "key" << BSON("superIdx"
- << "2d"))));
+ << "ns"
+ << _ns
+ << "unique"
+ << 1
+ << "sparse"
+ << true
+ << "expireAfterSeconds"
+ << 2400
+ << "key"
+ << BSON("superIdx"
+ << "2d"))));
}
};
@@ -883,7 +955,11 @@ protected:
BSONObj _createSpec(T storageEngineValue) {
return BSON("name"
<< "super2"
- << "ns" << _ns << "key" << BSON("a" << 1) << "storageEngine"
+ << "ns"
+ << _ns
+ << "key"
+ << BSON("a" << 1)
+ << "storageEngine"
<< storageEngineValue);
}
};
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index 13579765dfb..ee99ae37d3b 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -501,7 +501,8 @@ public:
ASSERT(BSON(""
<< "b"
<< ""
- << "h").woSortOrder(o, key) < 0);
+ << "h")
+ .woSortOrder(o, key) < 0);
}
ASSERT(BSON(""
@@ -754,135 +755,131 @@ public:
keyTest(BSON("" << now << "" << 3 << "" << jstNULL << "" << true));
keyTest(BSON("" << now << "" << 3 << "" << BSONObj() << "" << true));
+ {{// check signed dates with new key format
+ KeyV1Owned a(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(-50)).obj());
+ KeyV1Owned b(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(50)).obj());
+ ASSERT(a.woCompare(b, Ordering::make(BSONObj())) < 0);
+ }
+ {
+ // backward compatibility
+ KeyBson a(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(-50)).obj());
+ KeyBson b(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(50)).obj());
+ ASSERT(a.woCompare(b, Ordering::make(BSONObj())) > 0);
+ }
+ {
+ // this is an uncompactable key:
+ BSONObj uc1 = BSONObjBuilder()
+ .appendDate("", Date_t::fromMillisSinceEpoch(-50))
+ .appendCode("", "abc")
+ .obj();
+ BSONObj uc2 = BSONObjBuilder()
+ .appendDate("", Date_t::fromMillisSinceEpoch(55))
+ .appendCode("", "abc")
+ .obj();
+ ASSERT(uc1.woCompare(uc2, Ordering::make(BSONObj())) < 0);
{
- {
- // check signed dates with new key format
- KeyV1Owned a(
- BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(-50)).obj());
- KeyV1Owned b(
- BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(50)).obj());
- ASSERT(a.woCompare(b, Ordering::make(BSONObj())) < 0);
- }
- {
- // backward compatibility
- KeyBson a(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(-50)).obj());
- KeyBson b(BSONObjBuilder().appendDate("", Date_t::fromMillisSinceEpoch(50)).obj());
- ASSERT(a.woCompare(b, Ordering::make(BSONObj())) > 0);
- }
- {
- // this is an uncompactable key:
- BSONObj uc1 = BSONObjBuilder()
- .appendDate("", Date_t::fromMillisSinceEpoch(-50))
- .appendCode("", "abc")
- .obj();
- BSONObj uc2 = BSONObjBuilder()
- .appendDate("", Date_t::fromMillisSinceEpoch(55))
- .appendCode("", "abc")
- .obj();
- ASSERT(uc1.woCompare(uc2, Ordering::make(BSONObj())) < 0);
- {
- KeyV1Owned a(uc1);
- KeyV1Owned b(uc2);
- ASSERT(!a.isCompactFormat());
- ASSERT(a.woCompare(b, Ordering::make(BSONObj())) < 0);
- }
- {
- KeyBson a(uc1);
- KeyBson b(uc2);
- ASSERT(!a.isCompactFormat());
- ASSERT(a.woCompare(b, Ordering::make(BSONObj())) > 0);
- }
- }
+ KeyV1Owned a(uc1);
+ KeyV1Owned b(uc2);
+ ASSERT(!a.isCompactFormat());
+ ASSERT(a.woCompare(b, Ordering::make(BSONObj())) < 0);
}
-
{
- BSONObjBuilder b;
- b.appendBinData("f", 8, (BinDataType)1, "aaaabbbb");
- b.appendBinData("e", 3, (BinDataType)1, "aaa");
- b.appendBinData("b", 1, (BinDataType)1, "x");
- BSONObj o = b.obj();
- keyTest(o, true);
+ KeyBson a(uc1);
+ KeyBson b(uc2);
+ ASSERT(!a.isCompactFormat());
+ ASSERT(a.woCompare(b, Ordering::make(BSONObj())) > 0);
}
+ }
+}
- {
- // check (non)equality
- BSONObj a = BSONObjBuilder().appendBinData("", 8, (BinDataType)1, "abcdefgh").obj();
- BSONObj b = BSONObjBuilder().appendBinData("", 8, (BinDataType)1, "abcdefgj").obj();
- ASSERT(!a.equal(b));
- int res_ab = a.woCompare(b);
- ASSERT(res_ab != 0);
- keyTest(a, true);
- keyTest(b, true);
-
- // check subtypes do not equal
- BSONObj c = BSONObjBuilder().appendBinData("", 8, (BinDataType)4, "abcdefgh").obj();
- BSONObj d = BSONObjBuilder().appendBinData("", 8, (BinDataType)0x81, "abcdefgh").obj();
- ASSERT(!a.equal(c));
- int res_ac = a.woCompare(c);
- ASSERT(res_ac != 0);
- keyTest(c, true);
- ASSERT(!a.equal(d));
- int res_ad = a.woCompare(d);
- ASSERT(res_ad != 0);
- keyTest(d, true);
-
- KeyV1Owned A(a);
- KeyV1Owned B(b);
- KeyV1Owned C(c);
- KeyV1Owned D(d);
- ASSERT(!A.woEqual(B));
- ASSERT(A.woCompare(B, Ordering::make(BSONObj())) < 0 && res_ab < 0);
- ASSERT(!A.woEqual(C));
- ASSERT(A.woCompare(C, Ordering::make(BSONObj())) < 0 && res_ac < 0);
- ASSERT(!A.woEqual(D));
- ASSERT(A.woCompare(D, Ordering::make(BSONObj())) < 0 && res_ad < 0);
- }
+{
+ BSONObjBuilder b;
+ b.appendBinData("f", 8, (BinDataType)1, "aaaabbbb");
+ b.appendBinData("e", 3, (BinDataType)1, "aaa");
+ b.appendBinData("b", 1, (BinDataType)1, "x");
+ BSONObj o = b.obj();
+ keyTest(o, true);
+}
- {
- BSONObjBuilder b;
- b.appendBinData("f", 33, (BinDataType)1, "123456789012345678901234567890123");
- BSONObj o = b.obj();
- keyTest(o, false);
- }
+{
+ // check (non)equality
+ BSONObj a = BSONObjBuilder().appendBinData("", 8, (BinDataType)1, "abcdefgh").obj();
+ BSONObj b = BSONObjBuilder().appendBinData("", 8, (BinDataType)1, "abcdefgj").obj();
+ ASSERT(!a.equal(b));
+ int res_ab = a.woCompare(b);
+ ASSERT(res_ab != 0);
+ keyTest(a, true);
+ keyTest(b, true);
+
+ // check subtypes do not equal
+ BSONObj c = BSONObjBuilder().appendBinData("", 8, (BinDataType)4, "abcdefgh").obj();
+ BSONObj d = BSONObjBuilder().appendBinData("", 8, (BinDataType)0x81, "abcdefgh").obj();
+ ASSERT(!a.equal(c));
+ int res_ac = a.woCompare(c);
+ ASSERT(res_ac != 0);
+ keyTest(c, true);
+ ASSERT(!a.equal(d));
+ int res_ad = a.woCompare(d);
+ ASSERT(res_ad != 0);
+ keyTest(d, true);
+
+ KeyV1Owned A(a);
+ KeyV1Owned B(b);
+ KeyV1Owned C(c);
+ KeyV1Owned D(d);
+ ASSERT(!A.woEqual(B));
+ ASSERT(A.woCompare(B, Ordering::make(BSONObj())) < 0 && res_ab < 0);
+ ASSERT(!A.woEqual(C));
+ ASSERT(A.woCompare(C, Ordering::make(BSONObj())) < 0 && res_ac < 0);
+ ASSERT(!A.woEqual(D));
+ ASSERT(A.woCompare(D, Ordering::make(BSONObj())) < 0 && res_ad < 0);
+}
- {
- for (int i = 1; i <= 3; i++) {
- for (int j = 1; j <= 3; j++) {
- BSONObjBuilder b;
- b.appendBinData("f", i, (BinDataType)j, "abc");
- BSONObj o = b.obj();
- keyTest(o, j != ByteArrayDeprecated);
- }
- }
- }
+{
+ BSONObjBuilder b;
+ b.appendBinData("f", 33, (BinDataType)1, "123456789012345678901234567890123");
+ BSONObj o = b.obj();
+ keyTest(o, false);
+}
- {
+{
+ for (int i = 1; i <= 3; i++) {
+ for (int j = 1; j <= 3; j++) {
BSONObjBuilder b;
- b.appendBinData("f", 1, (BinDataType)133, "a");
+ b.appendBinData("f", i, (BinDataType)j, "abc");
BSONObj o = b.obj();
- keyTest(o, true);
+ keyTest(o, j != ByteArrayDeprecated);
}
+ }
+}
- {
- BSONObjBuilder b;
- b.append("AA", 3);
- b.appendBinData("f", 0, (BinDataType)0, "");
- b.appendBinData("e", 3, (BinDataType)7, "aaa");
- b.appendBinData("b", 1, (BinDataType)128, "x");
- b.append("z", 3);
- b.appendBinData("bb", 0, (BinDataType)129, "x");
- BSONObj o = b.obj();
- keyTest(o, true);
- }
+{
+ BSONObjBuilder b;
+ b.appendBinData("f", 1, (BinDataType)133, "a");
+ BSONObj o = b.obj();
+ keyTest(o, true);
+}
- {
- // 9 is not supported in compact format. so test a non-compact case here.
- BSONObjBuilder b;
- b.appendBinData("f", 9, (BinDataType)0, "aaaabbbbc");
- BSONObj o = b.obj();
- keyTest(o);
- }
- }
+{
+ BSONObjBuilder b;
+ b.append("AA", 3);
+ b.appendBinData("f", 0, (BinDataType)0, "");
+ b.appendBinData("e", 3, (BinDataType)7, "aaa");
+ b.appendBinData("b", 1, (BinDataType)128, "x");
+ b.append("z", 3);
+ b.appendBinData("bb", 0, (BinDataType)129, "x");
+ BSONObj o = b.obj();
+ keyTest(o, true);
+}
+
+{
+ // 9 is not supported in compact format. so test a non-compact case here.
+ BSONObjBuilder b;
+ b.appendBinData("f", 9, (BinDataType)0, "aaaabbbbc");
+ BSONObj o = b.obj();
+ keyTest(o);
+}
+}
};
class ToStringNumber {
@@ -1452,13 +1449,18 @@ class LabelShares : public LabelBase {
BSONObj expected() {
return BSON("z"
<< "q"
- << "a" << (BSON("$gt" << 1)) << "x"
+ << "a"
+ << (BSON("$gt" << 1))
+ << "x"
<< "p");
}
BSONObj actual() {
return BSON("z"
<< "q"
- << "a" << GT << 1 << "x"
+ << "a"
+ << GT
+ << 1
+ << "x"
<< "p");
}
};
@@ -1477,14 +1479,20 @@ class LabelDoubleShares : public LabelBase {
BSONObj expected() {
return BSON("z"
<< "q"
- << "a" << (BSON("$gt" << 1 << "$lte"
- << "x")) << "x"
+ << "a"
+ << (BSON("$gt" << 1 << "$lte"
+ << "x"))
+ << "x"
<< "p");
}
BSONObj actual() {
return BSON("z"
<< "q"
- << "a" << GT << 1 << LTE << "x"
+ << "a"
+ << GT
+ << 1
+ << LTE
+ << "x"
<< "x"
<< "p");
}
@@ -1503,17 +1511,33 @@ class LabelMulti : public LabelBase {
BSONObj expected() {
return BSON("z"
<< "q"
- << "a" << BSON("$gt" << 1 << "$lte"
- << "x") << "b" << BSON("$ne" << 1 << "$ne"
- << "f"
- << "$ne" << 22.3) << "x"
+ << "a"
+ << BSON("$gt" << 1 << "$lte"
+ << "x")
+ << "b"
+ << BSON("$ne" << 1 << "$ne"
+ << "f"
+ << "$ne"
+ << 22.3)
+ << "x"
<< "p");
}
BSONObj actual() {
return BSON("z"
<< "q"
- << "a" << GT << 1 << LTE << "x"
- << "b" << NE << 1 << NE << "f" << NE << 22.3 << "x"
+ << "a"
+ << GT
+ << 1
+ << LTE
+ << "x"
+ << "b"
+ << NE
+ << 1
+ << NE
+ << "f"
+ << NE
+ << 22.3
+ << "x"
<< "p");
}
};
@@ -1523,7 +1547,8 @@ class LabelishOr : public LabelBase {
<< "x"))
<< BSON("b" << BSON("$ne" << 1 << "$ne"
<< "f"
- << "$ne" << 22.3))
+ << "$ne"
+ << 22.3))
<< BSON("x"
<< "p")));
}
@@ -1960,9 +1985,12 @@ struct ArrayMacroTest {
<< "qux")));
BSONObj obj = BSON("0"
<< "hello"
- << "1" << 1 << "2" << BSON("foo" << BSON_ARRAY("bar"
- << "baz"
- << "qux")));
+ << "1"
+ << 1
+ << "2"
+ << BSON("foo" << BSON_ARRAY("bar"
+ << "baz"
+ << "qux")));
ASSERT_EQUALS(arr, obj);
ASSERT_EQUALS(arr["2"].type(), Object);
@@ -2071,26 +2099,38 @@ public:
// DBRef stuff -- json parser can't handle this yet
good(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1)));
+ << "$id"
+ << 1)));
good(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "$db"
+ << "$id"
+ << 1
+ << "$db"
<< "a")));
good(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "stuff" << 1)));
+ << "$id"
+ << 1
+ << "stuff"
+ << 1)));
good(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "$db"
+ << "$id"
+ << 1
+ << "$db"
<< "a"
- << "stuff" << 1)));
+ << "stuff"
+ << 1)));
bad(BSON("a" << BSON("$ref" << 1 << "$id" << 1)));
bad(BSON("a" << BSON("$ref" << 1 << "$id" << 1 << "$db"
<< "a")));
bad(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "$db" << 1)));
+ << "$id"
+ << 1
+ << "$db"
+ << 1)));
bad(BSON("a" << BSON("$ref"
<< "coll")));
bad(BSON("a" << BSON("$ref"
@@ -2102,10 +2142,16 @@ public:
<< "coll")));
bad(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "$hater" << 1)));
+ << "$id"
+ << 1
+ << "$hater"
+ << 1)));
bad(BSON("a" << BSON("$ref"
<< "coll"
- << "$id" << 1 << "dot.dot" << 1)));
+ << "$id"
+ << 1
+ << "dot.dot"
+ << 1)));
// _id isn't a RegEx, or Array
good("{_id: 0}");
diff --git a/src/mongo/dbtests/jsontests.cpp b/src/mongo/dbtests/jsontests.cpp
index 04a5b375a34..ecd156ed5a6 100644
--- a/src/mongo/dbtests/jsontests.cpp
+++ b/src/mongo/dbtests/jsontests.cpp
@@ -65,7 +65,8 @@ public:
void run() {
ASSERT_EQUALS("{ \"a\" : \"b\" }",
BSON("a"
- << "b").jsonString(Strict));
+ << "b")
+ .jsonString(Strict));
}
};
@@ -2473,7 +2474,8 @@ public:
virtual BSONObj bson() const {
return BSON("int" << 123 << "long" << 9223372036854775807ll // 2**63 - 1
- << "double" << 3.14);
+ << "double"
+ << 3.14);
}
virtual string json() const {
return "{ \"int\": 123, \"long\": 9223372036854775807, \"double\": 3.14 }";
@@ -2496,7 +2498,8 @@ public:
virtual BSONObj bson() const {
return BSON("int" << 123 << "long" << 9223372036854775807ll // 2**63 - 1
- << "double" << 3.14);
+ << "double"
+ << 3.14);
}
virtual string json() const {
return "{ 'int': NumberInt(123), "
@@ -2596,7 +2599,8 @@ public:
virtual BSONObj bson() const {
return BSON("int" << -123 << "long" << -9223372036854775807ll // -1 * (2**63 - 1)
- << "double" << -3.14);
+ << "double"
+ << -3.14);
}
virtual string json() const {
return "{ \"int\": -123, \"long\": -9223372036854775807, \"double\": -3.14 }";
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index 35a23e99f6c..0e25183116b 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -396,7 +396,8 @@ public:
<< "eliot"
<< "z"
<< "sara"
- << "zz" << BSONObj());
+ << "zz"
+ << BSONObj());
s->setObject("blah", o, true);
BSONObj out;
diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.cpp b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
index a77606e7ae9..45b189bf9e8 100644
--- a/src/mongo/dbtests/mock/mock_remote_db_server.cpp
+++ b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
@@ -36,10 +36,10 @@
#include "mongo/rpc/command_reply_builder.h"
#include "mongo/rpc/metadata.h"
#include "mongo/stdx/memory.h"
+#include "mongo/util/assert_util.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/socket_exception.h"
#include "mongo/util/time_support.h"
-#include "mongo/util/assert_util.h"
using std::string;
using std::vector;
diff --git a/src/mongo/dbtests/mock/mock_replica_set.h b/src/mongo/dbtests/mock/mock_replica_set.h
index c3f22c3cb97..b2b48747d8e 100644
--- a/src/mongo/dbtests/mock/mock_replica_set.h
+++ b/src/mongo/dbtests/mock/mock_replica_set.h
@@ -27,12 +27,12 @@
#pragma once
-#include "mongo/dbtests/mock/mock_remote_db_server.h"
#include "mongo/db/repl/member_config.h"
#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/dbtests/mock/mock_remote_db_server.h"
-#include <string>
#include <map>
+#include <string>
#include <vector>
namespace mongo {
diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
index 7febff697a3..d347eb76897 100644
--- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp
+++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
@@ -36,8 +36,8 @@
#include "mongo/dbtests/mock/mock_dbclient_connection.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/net/sock.h"
-#include "mongo/util/timer.h"
#include "mongo/util/net/socket_exception.h"
+#include "mongo/util/timer.h"
#include <ctime>
#include <string>
@@ -413,10 +413,16 @@ TEST(MockDBClientConnTest, CyclingCmd) {
vector<BSONObj> isMasterSequence;
isMasterSequence.push_back(BSON("set"
<< "a"
- << "isMaster" << true << "ok" << 1));
+ << "isMaster"
+ << true
+ << "ok"
+ << 1));
isMasterSequence.push_back(BSON("set"
<< "a"
- << "isMaster" << false << "ok" << 1));
+ << "isMaster"
+ << false
+ << "ok"
+ << 1));
server.setCommandReply("isMaster", isMasterSequence);
}
diff --git a/src/mongo/dbtests/multikey_paths_test.cpp b/src/mongo/dbtests/multikey_paths_test.cpp
index 429bc9447eb..a5031bcb44e 100644
--- a/src/mongo/dbtests/multikey_paths_test.cpp
+++ b/src/mongo/dbtests/multikey_paths_test.cpp
@@ -31,9 +31,9 @@
#include <iostream>
#include <string>
+#include "mongo/db/catalog/index_create.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/catalog/index_create.h"
#include "mongo/db/index/multikey_paths.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
@@ -91,7 +91,8 @@ public:
const bool match = (expectedMultikeyPaths == actualMultikeyPaths);
if (!match) {
FAIL(str::stream() << "Expected: " << dumpMultikeyPaths(expectedMultikeyPaths)
- << ", Actual: " << dumpMultikeyPaths(actualMultikeyPaths));
+ << ", Actual: "
+ << dumpMultikeyPaths(actualMultikeyPaths));
}
ASSERT_TRUE(match);
} else {
@@ -150,7 +151,10 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPattern));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPattern));
assertMultikeyPaths(collection, keyPattern, {std::set<size_t>{}, {0U}});
}
@@ -181,7 +185,10 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPattern));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPattern));
assertMultikeyPaths(collection, keyPattern, {{0U}, {0U}});
}
@@ -195,7 +202,10 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPattern));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPattern));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -235,7 +245,10 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPattern));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPattern));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -285,7 +298,10 @@ TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPattern));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPattern));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -326,13 +342,19 @@ TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) {
createIndex(collection,
BSON("name"
<< "a_1_b_1"
- << "ns" << _nss.ns() << "key" << keyPatternAB));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPatternAB));
BSONObj keyPatternAC = BSON("a" << 1 << "c" << 1);
createIndex(collection,
BSON("name"
<< "a_1_c_1"
- << "ns" << _nss.ns() << "key" << keyPatternAC));
+ << "ns"
+ << _nss.ns()
+ << "key"
+ << keyPatternAC));
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp
index b6d29ca2ddd..479d7d2317c 100644
--- a/src/mongo/dbtests/namespacetests.cpp
+++ b/src/mongo/dbtests/namespacetests.cpp
@@ -124,7 +124,9 @@ public:
const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
OperationContext& txn = *txnPtr;
BSONObj spec(BSON("key" << BSON("a"
- << "hashed") << "seed" << 0x5eed));
+ << "hashed")
+ << "seed"
+ << 0x5eed));
BSONObj nullObj = BSON("a" << BSONNULL);
BSONObjSet nullFieldKeySet;
diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp
index 977a4dad4b8..4a01d5ee9b2 100644
--- a/src/mongo/dbtests/oplogstarttests.cpp
+++ b/src/mongo/dbtests/oplogstarttests.cpp
@@ -223,8 +223,10 @@ protected:
void buildCollection() {
BSONObj info;
// Create a collection with specified extent sizes
- BSONObj command = BSON("create" << nss.coll() << "capped" << true << "$nExtents"
- << extentSizes() << "autoIndexId" << false);
+ BSONObj command =
+ BSON("create" << nss.coll() << "capped" << true << "$nExtents" << extentSizes()
+ << "autoIndexId"
+ << false);
ASSERT(client()->runCommand(nss.db().toString(), command, info));
// Populate documents.
diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp
index 970f7d02ac9..6acaffe12ff 100644
--- a/src/mongo/dbtests/plan_ranking.cpp
+++ b/src/mongo/dbtests/plan_ranking.cpp
@@ -230,11 +230,11 @@ public:
// both the {a:1} and {b:1} indices even though it performs poorly.
soln = pickBestPlan(cq.get());
- ASSERT(QueryPlannerTestLib::solutionMatches(
- "{fetch: {node: {andSorted: {nodes: ["
- "{ixscan: {filter: null, pattern: {a:1}}},"
- "{ixscan: {filter: null, pattern: {b:1}}}]}}}}",
- soln->root.get()));
+ ASSERT(
+ QueryPlannerTestLib::solutionMatches("{fetch: {node: {andSorted: {nodes: ["
+ "{ixscan: {filter: null, pattern: {a:1}}},"
+ "{ixscan: {filter: null, pattern: {b:1}}}]}}}}",
+ soln->root.get()));
}
};
@@ -267,11 +267,11 @@ public:
internalQueryForceIntersectionPlans = true;
QuerySolution* soln = pickBestPlan(cq.get());
- ASSERT(QueryPlannerTestLib::solutionMatches(
- "{fetch: {node: {andHash: {nodes: ["
- "{ixscan: {filter: null, pattern: {a:1}}},"
- "{ixscan: {filter: null, pattern: {b:1}}}]}}}}",
- soln->root.get()));
+ ASSERT(
+ QueryPlannerTestLib::solutionMatches("{fetch: {node: {andHash: {nodes: ["
+ "{ixscan: {filter: null, pattern: {a:1}}},"
+ "{ixscan: {filter: null, pattern: {b:1}}}]}}}}",
+ soln->root.get()));
// Confirm that a backup plan is available.
ASSERT(hasBackupPlan());
@@ -550,10 +550,10 @@ public:
// so we expect to choose {d: 1, e: 1}, as it allows us
// to avoid the sort stage.
QuerySolution* soln = pickBestPlan(cq.get());
- ASSERT(QueryPlannerTestLib::solutionMatches(
- "{fetch: {filter: {a:1}, node: "
- "{ixscan: {filter: null, pattern: {d:1,e:1}}}}}",
- soln->root.get()));
+ ASSERT(
+ QueryPlannerTestLib::solutionMatches("{fetch: {filter: {a:1}, node: "
+ "{ixscan: {filter: null, pattern: {d:1,e:1}}}}}",
+ soln->root.get()));
}
};
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp
index e24e4047ce2..24f31ebc1be 100644
--- a/src/mongo/dbtests/query_stage_count.cpp
+++ b/src/mongo/dbtests/query_stage_count.cpp
@@ -70,10 +70,13 @@ public:
_coll = _ctx.db()->createCollection(&_txn, ns());
_coll->getIndexCatalog()->createIndexOnEmptyCollection(&_txn,
- BSON("key"
- << BSON("x" << 1) << "name"
- << "x_1"
- << "ns" << ns() << "v" << 1));
+ BSON("key" << BSON("x" << 1)
+ << "name"
+ << "x_1"
+ << "ns"
+ << ns()
+ << "v"
+ << 1));
for (int i = 0; i < kDocuments; i++) {
insert(BSON(GENOID << "x" << i));
diff --git a/src/mongo/dbtests/query_stage_ensure_sorted.cpp b/src/mongo/dbtests/query_stage_ensure_sorted.cpp
index f89bbd42ea5..858106660c8 100644
--- a/src/mongo/dbtests/query_stage_ensure_sorted.cpp
+++ b/src/mongo/dbtests/query_stage_ensure_sorted.cpp
@@ -30,8 +30,8 @@
#include "mongo/db/client.h"
#include "mongo/db/exec/ensure_sorted.h"
-#include "mongo/db/exec/sort_key_generator.h"
#include "mongo/db/exec/queued_data_stage.h"
+#include "mongo/db/exec/sort_key_generator.h"
#include "mongo/db/json.h"
#include "mongo/db/query/collation/collator_interface_mock.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/dbtests/query_stage_subplan.cpp b/src/mongo/dbtests/query_stage_subplan.cpp
index 825152c4007..36a6e9f502b 100644
--- a/src/mongo/dbtests/query_stage_subplan.cpp
+++ b/src/mongo/dbtests/query_stage_subplan.cpp
@@ -105,7 +105,8 @@ public:
OldClientWriteContext ctx(&_txn, nss.ns());
addIndex(BSON("a"
<< "2d"
- << "b" << 1));
+ << "b"
+ << 1));
addIndex(BSON("a"
<< "2d"));
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 8cf6d28d1a5..46cc769b1d1 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -199,7 +199,8 @@ public:
bool ok = cl.runCommand("unittests",
BSON("godinsert"
<< "querytests"
- << "obj" << BSONObj()),
+ << "obj"
+ << BSONObj()),
info);
ASSERT(ok);
@@ -590,7 +591,12 @@ public:
_client.runCommand("unittests",
BSON("create"
<< "querytests.TailableQueryOnId"
- << "capped" << true << "size" << 8192 << "autoIndexId" << true),
+ << "capped"
+ << true
+ << "size"
+ << 8192
+ << "autoIndexId"
+ << true),
info);
insertA(ns, 0);
insertA(ns, 1);
@@ -676,7 +682,10 @@ public:
_client.runCommand("unittests",
BSON("create"
<< "querytests.OplogReplaySlaveReadTill"
- << "capped" << true << "size" << 8192),
+ << "capped"
+ << true
+ << "size"
+ << 8192),
info);
Date_t one = Date_t::fromMillisSinceEpoch(getNextGlobalTimestamp().asLL());
@@ -1285,14 +1294,18 @@ public:
ASSERT_EQUALS(17, _client.findOne(ns(), b.obj())["z"].number());
}
ASSERT_EQUALS(17,
- _client.findOne(ns(),
- BSON("x"
- << "eliot"))["z"].number());
+ _client
+ .findOne(ns(),
+ BSON("x"
+ << "eliot"))["z"]
+ .number());
ASSERT_OK(dbtests::createIndex(&_txn, ns(), BSON("x" << 1)));
ASSERT_EQUALS(17,
- _client.findOne(ns(),
- BSON("x"
- << "eliot"))["z"].number());
+ _client
+ .findOne(ns(),
+ BSON("x"
+ << "eliot"))["z"]
+ .number());
}
};
@@ -1314,7 +1327,8 @@ public:
ctx.db(),
ns(),
fromjson("{ capped : true, size : 2000, max: 10000 }"),
- false).isOK());
+ false)
+ .isOK());
wunit.commit();
}
@@ -1452,7 +1466,11 @@ public:
ASSERT(_client.runCommand("unittests",
BSON("create"
<< "querytests.findingstart"
- << "capped" << true << "$nExtents" << 5 << "autoIndexId"
+ << "capped"
+ << true
+ << "$nExtents"
+ << 5
+ << "autoIndexId"
<< false),
info));
@@ -1499,7 +1517,11 @@ public:
ASSERT(_client.runCommand("unittests",
BSON("create"
<< "querytests.findingstart"
- << "capped" << true << "$nExtents" << 5 << "autoIndexId"
+ << "capped"
+ << true
+ << "$nExtents"
+ << 5
+ << "autoIndexId"
<< false),
info));
@@ -1547,7 +1569,11 @@ public:
ASSERT(_client.runCommand("unittests",
BSON("create"
<< "querytests.findingstart"
- << "capped" << true << "$nExtents" << 5 << "autoIndexId"
+ << "capped"
+ << true
+ << "$nExtents"
+ << 5
+ << "autoIndexId"
<< false),
info));
@@ -1600,7 +1626,10 @@ public:
ASSERT(_client.runCommand("unittests",
BSON("create"
<< "querytests.exhaust"
- << "capped" << true << "size" << 8192),
+ << "capped"
+ << true
+ << "size"
+ << 8192),
info));
_client.insert(ns(), BSON("ts" << 0));
Message message;
diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp
index 68d36194b8f..bab15d05f48 100644
--- a/src/mongo/dbtests/replica_set_monitor_test.cpp
+++ b/src/mongo/dbtests/replica_set_monitor_test.cpp
@@ -29,8 +29,8 @@
#include "mongo/platform/basic.h"
#include "mongo/client/connpool.h"
-#include "mongo/client/dbclientinterface.h"
#include "mongo/client/dbclient_rs.h"
+#include "mongo/client/dbclientinterface.h"
#include "mongo/client/replica_set_monitor.h"
#include "mongo/client/replica_set_monitor_internal.h"
#include "mongo/dbtests/mock/mock_conn_registry.h"
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index ec092669747..10996568f12 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -916,7 +916,8 @@ public:
_client.insert("unittests.system.indexes",
BSON("ns" << ns() << "key" << BSON("a" << 1) << "name"
<< "foo"
- << "sparse" << true));
+ << "sparse"
+ << true));
}
~EmptyPushSparseIndex() {
_client.dropIndexes(ns());
@@ -1410,10 +1411,12 @@ public:
void run() {
bool threw = false;
BSONObj o = BSON("ns" << ns() << "o" << BSON("foo"
- << "bar") << "o2" << BSON("_id"
- << "in oplog"
- << "foo"
- << "bar"));
+ << "bar")
+ << "o2"
+ << BSON("_id"
+ << "in oplog"
+ << "foo"
+ << "bar"));
ScopedTransaction transaction(&_txn, MODE_X);
Lock::GlobalWrite lk(_txn.lockState());
@@ -1433,9 +1436,11 @@ public:
// now this should succeed
SyncTest t;
verify(t.shouldRetry(&_txn, o));
- verify(!_client.findOne(ns(),
- BSON("_id"
- << "on remote")).isEmpty());
+ verify(!_client
+ .findOne(ns(),
+ BSON("_id"
+ << "on remote"))
+ .isEmpty());
// force it not to find an obj
t.returnEmpty = true;
diff --git a/src/mongo/dbtests/sort_key_generator_test.cpp b/src/mongo/dbtests/sort_key_generator_test.cpp
index 5a8faa6d2b2..0993579b54e 100644
--- a/src/mongo/dbtests/sort_key_generator_test.cpp
+++ b/src/mongo/dbtests/sort_key_generator_test.cpp
@@ -30,8 +30,8 @@
#include "mongo/db/exec/sort_key_generator.h"
#include "mongo/db/json.h"
-#include "mongo/stdx/memory.h"
#include "mongo/db/query/query_test_service_context.h"
+#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 943bfffed15..5ab410361eb 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -98,7 +98,7 @@ const int nthr = 135;
#endif
class MongoMutexTest : public ThreadedTest<nthr> {
#if defined(MONGO_CONFIG_DEBUG_BUILD)
- enum { N = 2000 };
+ enum {N = 2000};
#else
enum { N = 4000 /*0*/ };
#endif
diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp
index c21b70a551f..961dd084be9 100644
--- a/src/mongo/dbtests/updatetests.cpp
+++ b/src/mongo/dbtests/updatetests.cpp
@@ -190,9 +190,11 @@ public:
<< "b"),
BSON("$set" << BSON("a"
<< "c")));
- ASSERT(!_client.findOne(ns(),
- BSON("a"
- << "c")).isEmpty());
+ ASSERT(!_client
+ .findOne(ns(),
+ BSON("a"
+ << "c"))
+ .isEmpty());
}
};
@@ -207,9 +209,11 @@ public:
<< "b"),
BSON("$set" << BSON("a"
<< "cd")));
- ASSERT(!_client.findOne(ns(),
- BSON("a"
- << "cd")).isEmpty());
+ ASSERT(!_client
+ .findOne(ns(),
+ BSON("a"
+ << "cd"))
+ .isEmpty());
}
};
@@ -363,9 +367,11 @@ public:
Query(),
BSON("$set" << BSON("a.b"
<< "llll")));
- ASSERT(!_client.findOne(ns(),
- BSON("a.b"
- << "llll")).isEmpty());
+ ASSERT(!_client
+ .findOne(ns(),
+ BSON("a.b"
+ << "llll"))
+ .isEmpty());
}
};
@@ -377,10 +383,11 @@ public:
Query(),
BSON("$set" << BSON("a.b"
<< "lllll")));
- ASSERT(_client.findOne(ns(),
- BSON("a.b"
- << "lllll")).woCompare(fromjson("{'_id':0,a:{b:'lllll'}}")) ==
- 0);
+ ASSERT(_client
+ .findOne(ns(),
+ BSON("a.b"
+ << "lllll"))
+ .woCompare(fromjson("{'_id':0,a:{b:'lllll'}}")) == 0);
}
};
@@ -392,10 +399,11 @@ public:
BSONObj(),
BSON("$set" << BSON("a.b"
<< "lllll")));
- ASSERT(_client.findOne(ns(),
- BSON("a.b"
- << "lllll")).woCompare(fromjson("{'_id':0,a:{b:'lllll'}}")) ==
- 0);
+ ASSERT(_client
+ .findOne(ns(),
+ BSON("a.b"
+ << "lllll"))
+ .woCompare(fromjson("{'_id':0,a:{b:'lllll'}}")) == 0);
}
};
@@ -1652,8 +1660,8 @@ public:
void run() {
_client.insert(ns(), fromjson("{'_id':0,x:[{a:1},{a:3}]}"));
// { $push : { x : { $each : [ {a:2} ], $sort: {a:1}, $slice:-2 } } }
- BSONObj pushObj = BSON("$each" << BSON_ARRAY(BSON("a" << 2)) << "$sort" << BSON("a" << 1)
- << "$slice" << -2.0);
+ BSONObj pushObj = BSON(
+ "$each" << BSON_ARRAY(BSON("a" << 2)) << "$sort" << BSON("a" << 1) << "$slice" << -2.0);
_client.update(ns(), Query(), BSON("$push" << BSON("x" << pushObj)));
BSONObj expected = fromjson("{'_id':0,x:[{a:2},{a:3}]}");
BSONObj result = _client.findOne(ns(), Query());
@@ -1667,8 +1675,9 @@ public:
BSONObj expected = fromjson("{'_id':0,x:[{a:1},{a:3}]}");
_client.insert(ns(), expected);
// { $push : { x : { $each : [ {a:2} ], $sort : {a:1}, $sort: {a:1} } } }
- BSONObj pushObj = BSON("$each" << BSON_ARRAY(BSON("a" << 2)) << "$sort" << BSON("a" << 1)
- << "$sort" << BSON("a" << 1));
+ BSONObj pushObj =
+ BSON("$each" << BSON_ARRAY(BSON("a" << 2)) << "$sort" << BSON("a" << 1) << "$sort"
+ << BSON("a" << 1));
_client.update(ns(), Query(), BSON("$push" << BSON("x" << pushObj)));
BSONObj result = _client.findOne(ns(), Query());
ASSERT_EQUALS(result, expected);
@@ -1748,7 +1757,9 @@ public:
ns(), BSON("_id" << 0 << "a" << 1 << "x" << BSONObj() << "x" << BSONObj() << "z" << 5));
_client.update(ns(), BSONObj(), BSON("$set" << BSON("x.b" << 1 << "x.c" << 1)));
ASSERT_EQUALS(BSON("_id" << 0 << "a" << 1 << "x" << BSON("b" << 1 << "c" << 1) << "x"
- << BSONObj() << "z" << 5),
+ << BSONObj()
+ << "z"
+ << 5),
_client.findOne(ns(), BSONObj()));
}
};
@@ -1762,7 +1773,9 @@ public:
_client.update(
ns(), BSONObj(), BSON("$set" << BSON("x.b" << 1 << "x.c" << 1 << "x.d" << 1)));
ASSERT_EQUALS(BSON("_id" << 0 << "x" << BSON("b" << 1 << "c" << 1 << "d" << 1) << "x"
- << BSONObj() << "x" << BSONObj()),
+ << BSONObj()
+ << "x"
+ << BSONObj()),
_client.findOne(ns(), BSONObj()));
}
};
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index dbaffd3f8bf..99b08f298fd 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -167,13 +167,16 @@ public:
wunit.commit();
}
- auto status =
- dbtests::createIndexFromSpec(&_txn,
- coll->ns().ns(),
- BSON("name"
- << "a"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false));
+ auto status = dbtests::createIndexFromSpec(&_txn,
+ coll->ns().ns(),
+ BSON("name"
+ << "a"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "background"
+ << false));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -225,13 +228,16 @@ public:
wunit.commit();
}
- auto status =
- dbtests::createIndexFromSpec(&_txn,
- coll->ns().ns(),
- BSON("name"
- << "a"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false));
+ auto status = dbtests::createIndexFromSpec(&_txn,
+ coll->ns().ns(),
+ BSON("name"
+ << "a"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "background"
+ << false));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -355,13 +361,16 @@ public:
ASSERT_TRUE(checkValid());
// Create multi-key index.
- auto status =
- dbtests::createIndexFromSpec(&_txn,
- coll->ns().ns(),
- BSON("name"
- << "multikey_index"
- << "ns" << coll->ns().ns() << "key"
- << BSON("a.b" << 1) << "background" << false));
+ auto status = dbtests::createIndexFromSpec(&_txn,
+ coll->ns().ns(),
+ BSON("name"
+ << "multikey_index"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a.b" << 1)
+ << "background"
+ << false));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -416,13 +425,18 @@ public:
}
// Create a sparse index.
- auto status =
- dbtests::createIndexFromSpec(&_txn,
- coll->ns().ns(),
- BSON("name"
- << "sparse_index"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false << "sparse" << true));
+ auto status = dbtests::createIndexFromSpec(&_txn,
+ coll->ns().ns(),
+ BSON("name"
+ << "sparse_index"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "background"
+ << false
+ << "sparse"
+ << true));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -469,14 +483,18 @@ public:
}
// Create a partial index.
- auto status =
- dbtests::createIndexFromSpec(&_txn,
- coll->ns().ns(),
- BSON("name"
- << "partial_index"
- << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false << "partialFilterExpression"
- << BSON("a" << BSON("$gt" << 1))));
+ auto status = dbtests::createIndexFromSpec(&_txn,
+ coll->ns().ns(),
+ BSON("name"
+ << "partial_index"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << 1)
+ << "background"
+ << false
+ << "partialFilterExpression"
+ << BSON("a" << BSON("$gt" << 1))));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -529,17 +547,23 @@ public:
coll->ns().ns(),
BSON("name"
<< "compound_index_1"
- << "ns" << coll->ns().ns() << "key"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
<< BSON("a" << 1 << "b" << -1)
- << "background" << false));
+ << "background"
+ << false));
ASSERT_OK(status);
status = dbtests::createIndexFromSpec(&_txn,
coll->ns().ns(),
BSON("name"
<< "compound_index_2"
- << "ns" << coll->ns().ns() << "key"
- << BSON("a" << -1 << "b" << 1) << "background"
+ << "ns"
+ << coll->ns().ns()
+ << "key"
+ << BSON("a" << -1 << "b" << 1)
+ << "background"
<< false));
ASSERT_OK(status);
@@ -588,7 +612,8 @@ public:
&_txn,
coll->ns().ns(),
BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false));
+ << "background"
+ << false));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());
@@ -648,7 +673,8 @@ public:
&_txn,
coll->ns().ns(),
BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
- << "background" << false));
+ << "background"
+ << false));
ASSERT_OK(status);
ASSERT_TRUE(checkValid());