summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/index_key_validate_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/index_key_validate_test.cpp')
-rw-r--r--src/mongo/db/catalog/index_key_validate_test.cpp95
1 files changed, 0 insertions, 95 deletions
diff --git a/src/mongo/db/catalog/index_key_validate_test.cpp b/src/mongo/db/catalog/index_key_validate_test.cpp
index 659a0bfb7b2..2c25d1b8791 100644
--- a/src/mongo/db/catalog/index_key_validate_test.cpp
+++ b/src/mongo/db/catalog/index_key_validate_test.cpp
@@ -318,100 +318,5 @@ TEST(IndexKeyValidateTest, Background) {
nullptr, fromjson("{key: {a: 1}, name: 'index', background: []}")));
}
-TEST(IndexKeyValidateTest, RemoveUnkownFieldsFromIndexSpecs) {
- ASSERT(fromjson("{key: {a: 1}, name: 'index'}")
- .binaryEqual(index_key_validate::removeUnknownFields(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', safe: true, force: true}"))));
-}
-
-TEST(IndexKeyValidateTest, UpdateTTLIndexNaNExpireAfterSeconds) {
- ASSERT(BSON("key" << BSON("a" << 1) << "name"
- << "index"
- << "expireAfterSeconds" << std::numeric_limits<int32_t>::max()
- << IndexDescriptor::kIndexVersionFieldName << IndexVersion::kV2)
- .binaryEqual(unittest::assertGet(index_key_validate::validateIndexSpec(
- nullptr, fromjson("{key: {a: 1}, name: 'index', expireAfterSeconds: NaN}")))));
-}
-
-TEST(IndexKeyValidateTest, ValidateAfterSecondsAcceptsFloatingPointNumber) {
- auto spec = unittest::assertGet(index_key_validate::validateIndexSpec(
- nullptr, fromjson("{key: {a: 1}, name: 'index', expireAfterSeconds: 123.456}")));
-
- // TTLMonitor extracts 'expireAfterSeconds' using BSONElement::safeNumberLong().
- ASSERT_EQUALS(spec["expireAfterSeconds"].safeNumberLong(), 123LL);
-}
-
-TEST(IndexKeyValidateTest, RepairIndexSpecs) {
- ASSERT(fromjson("{key: {a: 1}, name: 'index'}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', safe: true, force: true}"))));
-
- ASSERT(fromjson("{key: {a: 1}, name: 'index', sparse: true}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', sparse: 'true'}"))));
-
- ASSERT(fromjson("{key: {a: 1}, name: 'index', background: true}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', background: '1'}"))));
-
- ASSERT(fromjson("{key: {a: 1}, name: 'index', sparse: true, background: true}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', sparse: 'true', background: '1'}"))));
-
- ASSERT(fromjson("{key: {a: 1}, name: 'index', sparse: true, background: true}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', sparse: 'true', background: '1', safe: "
- "true, force: true}"))));
-
- ASSERT(fromjson("{key: {a: 1}, name: 'index'}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', weights: {key: 1, name: 1}}"))));
-
- ASSERT(fromjson("{key: {'a': 'text'}, name: 'index', weights: {key: 1, name: 1}}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {'a': 'text'}, name: 'index', weights: {key: 1, name: 1}}"))));
-
- ASSERT(fromjson("{key: {'$**': 'text'}, name: 'index', weights: {key: 1, name: 1}}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {'$**': 'text'}, name: 'index', weights: {key: 1, name: 1}}"))));
-
- ASSERT(fromjson("{key: {'data.loc' : '2dsphere_bucket'}, 'name': 'loc_2dsphere', "
- "'2dsphereIndexVersion' : 3}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {'data.loc' : '2dsphere_bucket'}, 'name': 'loc_2dsphere', "
- "'2dsphereIndexVersion' : 3}"))));
-
- ASSERT(
- fromjson("{key: {a: 1, 'name': 'text'}, name: 'index', weights: {key: 1, name: 1}}")
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson(
- "{key: {a: 1, 'name': 'text'}, name: 'index', weights: {key: 1, name: 1}}"))));
-
- ASSERT(BSON("key" << BSON("a" << 1) << "name"
- << "index"
- << "expireAfterSeconds" << std::numeric_limits<int32_t>::max())
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', expireAfterSeconds: NaN}"))));
-
- ASSERT(BSON("key" << BSON("a" << 1) << "name"
- << "index"
- << "expireAfterSeconds" << std::numeric_limits<int32_t>::max())
- .binaryEqual(index_key_validate::repairIndexSpec(
- NamespaceString("coll"),
- fromjson("{key: {a: 1}, name: 'index', expireAfterSeconds: '123'}"))));
-}
-
} // namespace
} // namespace mongo