summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/indexupdatetests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests/indexupdatetests.cpp')
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp168
1 files changed, 40 insertions, 128 deletions
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index bd479539a13..63ed34e3871 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -134,16 +134,9 @@ public:
const BSONObj spec = BSON("name"
<< "a"
- << "ns"
- << coll->ns().ns()
- << "key"
- << BSON("a" << 1)
- << "v"
- << static_cast<int>(kIndexVersion)
- << "unique"
- << true
- << "background"
- << background);
+ << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v"
+ << static_cast<int>(kIndexVersion) << "unique" << true
+ << "background" << background);
ON_BLOCK_EXIT([&] { indexer.cleanUpAfterBuild(&_opCtx, coll); });
@@ -189,16 +182,9 @@ public:
const BSONObj spec = BSON("name"
<< "a"
- << "ns"
- << coll->ns().ns()
- << "key"
- << BSON("a" << 1)
- << "v"
- << static_cast<int>(kIndexVersion)
- << "unique"
- << true
- << "background"
- << background);
+ << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v"
+ << static_cast<int>(kIndexVersion) << "unique" << true
+ << "background" << background);
ON_BLOCK_EXIT([&] { indexer.cleanUpAfterBuild(&_opCtx, coll); });
@@ -242,8 +228,7 @@ public:
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("a" << 1) << "ns" << _ns << "name"
<< "a_1"
- << "v"
- << static_cast<int>(kIndexVersion));
+ << "v" << static_cast<int>(kIndexVersion));
// The call is interrupted because mayInterrupt == true.
ASSERT_TRUE(buildIndexInterrupted(indexInfo));
// only want to interrupt the index build
@@ -286,8 +271,7 @@ public:
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("_id" << 1) << "ns" << _ns << "name"
<< "_id_"
- << "v"
- << static_cast<int>(kIndexVersion));
+ << "v" << static_cast<int>(kIndexVersion));
ASSERT_TRUE(buildIndexInterrupted(indexInfo));
// only want to interrupt the index build
getGlobalServiceContext()->unsetKillAllOperations();
@@ -333,11 +317,7 @@ public:
ASSERT_OK(createIndex("unittest",
BSON("name"
<< "x"
- << "ns"
- << _ns
- << "key"
- << BSON("x" << 1 << "y" << 1)
- << "v"
+ << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1) << "v"
<< static_cast<int>(kIndexVersion))));
}
};
@@ -350,13 +330,8 @@ public:
createIndex("unittest",
BSON("name"
<< "x"
- << "ns"
- << _ns
- << "unique"
- << true
- << "key"
- << BSON("x" << 1 << "y" << 1)
- << "v"
+ << "ns" << _ns << "unique" << true << "key"
+ << BSON("x" << 1 << "y" << 1) << "v"
<< static_cast<int>(kIndexVersion))));
}
};
@@ -367,11 +342,7 @@ public:
ASSERT_OK(createIndex("unittest",
BSON("name"
<< "x"
- << "ns"
- << _ns
- << "key"
- << BSON("x" << 1 << "y" << 1)
- << "v"
+ << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1) << "v"
<< static_cast<int>(kIndexVersion))));
}
};
@@ -384,11 +355,7 @@ public:
createIndex("unittest",
BSON("name"
<< "x"
- << "ns"
- << _ns
- << "key"
- << BSON("y" << 1 << "x" << 1)
- << "v"
+ << "ns" << _ns << "key" << BSON("y" << 1 << "x" << 1) << "v"
<< static_cast<int>(kIndexVersion))));
}
};
@@ -402,19 +369,11 @@ public:
ASSERT_OK(createIndex("unittests",
BSON("name"
<< "super"
- << "ns"
- << _ns
- << "unique"
- << 1
- << "sparse"
- << true
- << "expireAfterSeconds"
- << 3600
- << "key"
+ << "ns" << _ns << "unique" << 1 << "sparse" << true
+ << "expireAfterSeconds" << 3600 << "key"
<< BSON("superIdx"
<< "2d")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
@@ -428,19 +387,11 @@ public:
createIndex("unittests",
BSON("name"
<< "super2"
- << "ns"
- << _ns
- << "expireAfterSeconds"
- << 3600
- << "sparse"
- << true
- << "unique"
- << 1
- << "key"
+ << "ns" << _ns << "expireAfterSeconds" << 3600 << "sparse"
+ << true << "unique" << 1 << "key"
<< BSON("superIdx"
<< "2d")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
@@ -452,19 +403,11 @@ public:
ASSERT_OK(createIndex("unittests",
BSON("name"
<< "super"
- << "ns"
- << _ns
- << "expireAfterSeconds"
- << 3600
- << "sparse"
- << true
- << "unique"
- << 1
- << "key"
+ << "ns" << _ns << "expireAfterSeconds" << 3600 << "sparse"
+ << true << "unique" << 1 << "key"
<< BSON("superIdx"
<< "2d")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
@@ -478,44 +421,27 @@ public:
createIndex("unittest",
BSON("name"
<< "super2"
- << "ns"
- << _ns
- << "unique"
- << false
- << "sparse"
- << true
- << "expireAfterSeconds"
- << 3600
- << "key"
+ << "ns" << _ns << "unique" << false << "sparse" << true
+ << "expireAfterSeconds" << 3600 << "key"
<< BSON("superIdx"
<< "2d")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
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")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ ASSERT_EQUALS(
+ ErrorCodes::IndexOptionsConflict,
+ createIndex("unittest",
+ BSON("name"
+ << "super2"
+ << "ns" << _ns << "unique" << 1 << "sparse" << false << "background"
+ << true << "expireAfterSeconds" << 3600 << "key"
+ << BSON("superIdx"
+ << "2d")
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
@@ -526,19 +452,11 @@ public:
createIndex("unittest",
BSON("name"
<< "super2"
- << "ns"
- << _ns
- << "unique"
- << 1
- << "sparse"
- << true
- << "expireAfterSeconds"
- << 2400
- << "key"
+ << "ns" << _ns << "unique" << 1 << "sparse" << true
+ << "expireAfterSeconds" << 2400 << "key"
<< BSON("superIdx"
<< "2d")
- << "v"
- << static_cast<int>(kIndexVersion))));
+ << "v" << static_cast<int>(kIndexVersion))));
}
};
@@ -585,14 +503,8 @@ protected:
BSONObj _createSpec(T storageEngineValue) {
return BSON("name"
<< "super2"
- << "ns"
- << _ns
- << "key"
- << BSON("a" << 1)
- << "v"
- << static_cast<int>(kIndexVersion)
- << "storageEngine"
- << storageEngineValue);
+ << "ns" << _ns << "key" << BSON("a" << 1) << "v"
+ << static_cast<int>(kIndexVersion) << "storageEngine" << storageEngineValue);
}
};