Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Add test for alter with bad field type.

Kishore Nallan3e08b7d556b8
diff --git a/test/collection_schema_change_test.cpp b/test/collection_schema_change_test.cpp
index df858c5c..8ffd09cc 100644
--- a/test/collection_schema_change_test.cpp
+++ b/test/collection_schema_change_test.cpp
@@ -465,6 +465,17 @@ TEST_F(CollectionSchemaChangeTest, AlterValidations) {
ASSERT_FALSE(alter_op.ok());
ASSERT_EQ("Only `fields` can be updated at the moment.",alter_op.error());
+ // 9. bad datatype in alter
+ schema_changes = R"({
+ "fields": [
+ {"name": "title", "drop": true},
+ {"name": "title", "type": "foobar"}
+ ]
+ })"_json;
+ alter_op = coll1->alter(schema_changes);
+ ASSERT_FALSE(alter_op.ok());
+ ASSERT_EQ("Field `title` has an invalid data type `foobar`, see docs for supported data types.",alter_op.error());
+
collectionManager.drop_collection("coll1");
}