summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shard_key_index_util_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/shard_key_index_util_test.cpp')
-rw-r--r--src/mongo/db/s/shard_key_index_util_test.cpp63
1 files changed, 4 insertions, 59 deletions
diff --git a/src/mongo/db/s/shard_key_index_util_test.cpp b/src/mongo/db/s/shard_key_index_util_test.cpp
index cba87669945..c9c1b4fdc23 100644
--- a/src/mongo/db/s/shard_key_index_util_test.cpp
+++ b/src/mongo/db/s/shard_key_index_util_test.cpp
@@ -203,12 +203,9 @@ TEST_F(ShardKeyIndexUtilTest, LastShardIndexWithSingleCandidate) {
createIndex(BSON("key" << BSON("x" << 1) << "name"
<< "x"
<< "v" << kIndexVersion));
- createIndex(BSON("key" << BSON("x" << 1 << "y" << 1) << "name"
- << "xy"
- << "v" << kIndexVersion << "hidden" << true));
- ASSERT_TRUE(isLastNonHiddenRangedShardKeyIndex(
- opCtx(), coll(), coll()->getIndexCatalog(), "x", BSON("x" << 1)));
+ ASSERT_TRUE(
+ isLastShardKeyIndex(opCtx(), coll(), coll()->getIndexCatalog(), "x", BSON("x" << 1)));
}
TEST_F(ShardKeyIndexUtilTest, LastShardIndexWithMultipleCandidates) {
@@ -222,60 +219,8 @@ TEST_F(ShardKeyIndexUtilTest, LastShardIndexWithMultipleCandidates) {
<< "xy"
<< "v" << kIndexVersion));
- ASSERT_FALSE(isLastNonHiddenRangedShardKeyIndex(
- opCtx(), coll(), coll()->getIndexCatalog(), "x", BSON("x" << 1)));
-}
-
-TEST_F(ShardKeyIndexUtilTest, LastShardIndexWithIncompatibleIndex) {
- createIndex(BSON("key" << BSON("y" << 1) << "name"
- << "y"
- << "v" << kIndexVersion));
- createIndex(BSON("key" << BSON("x" << 1) << "name"
- << "x"
- << "v" << kIndexVersion));
-
- ASSERT_FALSE(isLastNonHiddenRangedShardKeyIndex(
- opCtx(), coll(), coll()->getIndexCatalog(), "y", BSON("x" << 1)));
-}
-
-TEST_F(ShardKeyIndexUtilTest, LastShardIndexWithNonExistingIndex) {
- createIndex(BSON("key" << BSON("x" << 1) << "name"
- << "x"
- << "v" << kIndexVersion));
-
- ASSERT_FALSE(isLastNonHiddenRangedShardKeyIndex(
- opCtx(), coll(), coll()->getIndexCatalog(), "y", BSON("x" << 1)));
-}
-
-TEST_F(ShardKeyIndexUtilTest, LastShardIndexExcludesHashedIndex) {
- createIndex(BSON("key" << BSON("x"
- << "hashed")
- << "name"
- << "xhashed"
- << "v" << kIndexVersion));
-
- ASSERT_FALSE(isLastNonHiddenRangedShardKeyIndex(opCtx(),
- coll(),
- coll()->getIndexCatalog(),
- "y",
- BSON("x"
- << "hashed")));
-}
-
-TEST_F(ShardKeyIndexUtilTest, LastShardIndexExcludesCompoundHashedIndex) {
- createIndex(BSON("key" << BSON("x"
- << "hashed"
- << "y" << 1)
- << "name"
- << "xhashed"
- << "v" << kIndexVersion));
-
- ASSERT_FALSE(isLastNonHiddenRangedShardKeyIndex(opCtx(),
- coll(),
- coll()->getIndexCatalog(),
- "y",
- BSON("x"
- << "hashed")));
+ ASSERT_FALSE(
+ isLastShardKeyIndex(opCtx(), coll(), coll()->getIndexCatalog(), "x", BSON("x" << 1)));
}
} // namespace